public SqsActor () { Receive<string> (x => { var sqs_url = Environment.GetEnvironmentVariable("sqs_url", EnvironmentVariableTarget.Process); var config = new AmazonSQSConfig(); config.ServiceURL = sqs_url; var creds = new StoredProfileAWSCredentials(); var client = new AmazonSQSClient(creds, config); var msg = x + " and what " + Guid.NewGuid().ToString(); var queue_url = Environment.GetEnvironmentVariable("queue_url", EnvironmentVariableTarget.Process); var request = new Amazon.SQS.Model.SendMessageRequest(queue_url, msg); client.SendMessage(request); Sender.Tell(string.Format("done : [{0}]", msg )); }); }
/// <summary> /// Constructs the transport with the specified settings /// </summary> public AmazonSqsTransport(string inputQueueAddress, string accessKeyId, string secretAccessKey, AmazonSQSConfig amazonSqsConfig, IRebusLoggerFactory rebusLoggerFactory, IAsyncTaskFactory asyncTaskFactory) { if (accessKeyId == null) throw new ArgumentNullException(nameof(accessKeyId)); if (secretAccessKey == null) throw new ArgumentNullException(nameof(secretAccessKey)); if (amazonSqsConfig == null) throw new ArgumentNullException(nameof(amazonSqsConfig)); if (rebusLoggerFactory == null) throw new ArgumentNullException(nameof(rebusLoggerFactory)); Address = inputQueueAddress; _log = rebusLoggerFactory.GetCurrentClassLogger(); if (Address != null) { if (Address.Contains("/") && !Uri.IsWellFormedUriString(Address, UriKind.Absolute)) { throw new ArgumentException( "You could either have a simple queue name without slash (eg. \"inputqueue\") - or a complete URL for the queue endpoint. (eg. \"https://sqs.eu-central-1.amazonaws.com/234234234234234/somqueue\")", nameof(inputQueueAddress)); } } _accessKeyId = accessKeyId; _secretAccessKey = secretAccessKey; _amazonSqsConfig = amazonSqsConfig; _asyncTaskFactory = asyncTaskFactory; }
public ResponseSender() { // initialize Amazon SQSClient AmazonSQSConfig sqsConfig = new AmazonSQSConfig(); sqsConfig.ServiceURL = ConfigurationManager.AppSettings["SQSServiceURL"].ToString(); m_sqsClient = AWSClientFactory.CreateAmazonSQSClient(sqsConfig); }
public bool Execute() { Console.WriteLine($"Moving {Count} messages from {SourceQueueName} to {DestinationQueueName} in {Region}."); var config = new AmazonSQSConfig { RegionEndpoint = RegionEndpoint.GetBySystemName(Region) }; var client = new DefaultAwsClientFactory().GetSqsClient(config.RegionEndpoint); var sourceQueue = new SqsQueueByName(config.RegionEndpoint, SourceQueueName, client, JustSayingConstants.DEFAULT_HANDLER_RETRY_COUNT); var destinationQueue = new SqsQueueByName(config.RegionEndpoint, DestinationQueueName, client, JustSayingConstants.DEFAULT_HANDLER_RETRY_COUNT); EnsureQueueExists(sourceQueue); EnsureQueueExists(destinationQueue); var messages = PopMessagesFromSourceQueue(sourceQueue); var receiptHandles = messages.ToDictionary(m => m.MessageId, m => m.ReceiptHandle); var sendResponse = destinationQueue.Client.SendMessageBatch(new SendMessageBatchRequest { QueueUrl = destinationQueue.Url, Entries = messages.Select(x => new SendMessageBatchRequestEntry { Id = x.MessageId, MessageBody = x.Body }).ToList() }); var deleteResponse = sourceQueue.Client.DeleteMessageBatch(new DeleteMessageBatchRequest { QueueUrl = sourceQueue.Url, Entries = sendResponse.Successful.Select(x => new DeleteMessageBatchRequestEntry { Id = x.Id, ReceiptHandle = receiptHandles[x.Id] }).ToList() }); Console.WriteLine($"Moved {sendResponse.Successful.Count} messages from {SourceQueueName} to {DestinationQueueName} in {Region}."); return true; }
public AmazonSQS(string keyId, string secretKey) { sqsConfig = new AmazonSQSConfig(); //sqsConfig.ServiceURL = "https://sqs.amazonaws.com"; client = AWSClientFactory.CreateAmazonSQSClient(keyId, secretKey, sqsConfig); queueUrls = new Dictionary<string, string>(); }
/// <summary> /// Constructs AmazonSQSClient with AWS Access Key ID and AWS Secret Key /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> /// <param name="config">configuration</param> public AmazonSQSClient(String awsAccessKeyId, String awsSecretAccessKey, AmazonSQSConfig config) { this.awsAccessKeyId = awsAccessKeyId; this.awsSecretAccessKey = awsSecretAccessKey; this.config = config; ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; }
/// <summary> /// Constructs AmazonSQSClient with AWS Access Key ID, AWS Secret Key and an /// AmazonSQS Configuration object. If the config object's /// UseSecureStringForAwsSecretKey is false, the AWS Secret Key /// is stored as a clear-text string. Please use this option only /// if the application environment doesn't allow the use of SecureStrings. /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> /// <param name="config">The AmazonSQS Configuration Object</param> public AmazonSQSClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonSQSConfig config) { if (!String.IsNullOrEmpty(awsSecretAccessKey)) { clearAwsSecretAccessKey = awsSecretAccessKey; } this.awsAccessKeyId = awsAccessKeyId; this.config = config; }
public string CreateQueue(string queueName) { var amazonSqsConfig = new AmazonSQSConfig {ServiceURL = ServiceUrl}; using (var sqsClient = _awsConfig.CreateAwsClient<AmazonSQSClient>(amazonSqsConfig)) { var response = sqsClient.CreateQueue(new CreateQueueRequest(queueName)); return response.QueueUrl; } }
/// <summary> /// Configures Rebus to use Amazon Simple Queue Service as the message transport /// </summary> public static void UseAmazonSqsAsOneWayClient(this StandardConfigurer<ITransport> configurer, string accessKeyId, string secretAccessKey, AmazonSQSConfig amazonSqsConfig) { configurer.Register(c => { var rebusLoggerFactory = c.Get<IRebusLoggerFactory>(); var asyncTaskFactory = c.Get<IAsyncTaskFactory>(); return new AmazonSqsTransport(null, accessKeyId, secretAccessKey, amazonSqsConfig, rebusLoggerFactory, asyncTaskFactory); }); OneWayClientBackdoor.ConfigureOneWayClient(configurer); }
/// <summary> /// Instantiates the Poller. /// </summary> /// <param name="props"> /// A <see cref="MessageGearsProperties"/> /// </param> /// <param name="listener"> /// A <see cref="MessageGearsListener"/> /// </param> /// <param name="myAwsAccountKey"> /// You AWS Account Key /// </param> /// <param name="myAwsSecretKey"> /// Your AWS Secret Key /// </param> public MessageGearsAwsQueuePoller(MessageGearsAwsProperties props, MessageGearsListener listener) { this.props = props; this.emptyQueueDelayMillis = props.EmptyQueuePollingDelaySecs * 1000; this.listener = listener; AmazonSQSConfig config = new AmazonSQSConfig().WithMaxErrorRetry(props.SQSMaxErrorRetry); this.sqs = AWSClientFactory.CreateAmazonSQSClient (props.MyAWSAccountKey, props.MyAWSSecretKey, config); this.receiveMessageRequest = new ReceiveMessageRequest () .WithQueueUrl (props.MyAWSEventQueueUrl) .WithMaxNumberOfMessages (props.SQSMaxBatchSize) .WithAttributeName("ApproximateReceiveCount") .WithVisibilityTimeout(props.SQSVisibilityTimeoutSecs); this.deleteMessageRequest = new DeleteMessageRequest().WithQueueUrl(props.MyAWSEventQueueUrl); }
static AmazonSqsTransport CreateTransport(string inputQueueAddress, TimeSpan peeklockDuration) { var amazonSqsConfig = new AmazonSQSConfig { RegionEndpoint = RegionEndpoint.GetBySystemName(ConnectionInfo.RegionEndpoint) }; var consoleLoggerFactory = new ConsoleLoggerFactory(false); var transport = new AmazonSqsTransport(inputQueueAddress, ConnectionInfo.AccessKeyId, ConnectionInfo.SecretAccessKey, amazonSqsConfig, consoleLoggerFactory, new TplAsyncTaskFactory(consoleLoggerFactory)); transport.Initialize(peeklockDuration); transport.Purge(); return transport; }
protected override void SetUp() { var connectionInfo = AmazonSqsTransportFactory.ConnectionInfo; var accessKeyId = connectionInfo.AccessKeyId; var secretAccessKey = connectionInfo.SecretAccessKey; var amazonSqsConfig = new AmazonSQSConfig { RegionEndpoint = RegionEndpoint.GetBySystemName(AmazonSqsTransportFactory.ConnectionInfo.RegionEndpoint) }; _activator = Using(new BuiltinHandlerActivator()); Configure.With(_activator) .Transport(t => t.UseAmazonSqs(accessKeyId, secretAccessKey, amazonSqsConfig, TestConfig.QueueName("defertest"))) .Options(o => o.LogPipeline()) .Start(); }
/// <summary> /// Constructor taking the landing zone /// </summary> public DataRouterReportQueue(string InQueueName, string InLandingZoneTempPath, int InDecimateWaitingCountStart, int InDecimateWaitingCountEnd) : base(InQueueName, InLandingZoneTempPath, InDecimateWaitingCountStart, InDecimateWaitingCountEnd) { AWSCredentials Credentials = new StoredProfileAWSCredentials(Config.Default.AWSProfileName, Config.Default.AWSCredentialsFilepath); AmazonSQSConfig SqsConfig = new AmazonSQSConfig { ServiceURL = Config.Default.AWSSQSServiceURL }; SqsClient = new AmazonSQSClient(Credentials, SqsConfig); AmazonS3Config S3Config = new AmazonS3Config { ServiceURL = Config.Default.AWSS3ServiceURL }; S3Client = new AmazonS3Client(Credentials, S3Config); }
/// <summary> /// Configures Rebus to use Amazon Simple Queue Service as the message transport /// </summary> public static void UseAmazonSqs(this StandardConfigurer<ITransport> configurer, string accessKeyId, string secretAccessKey, AmazonSQSConfig config, string inputQueueAddress) { configurer.Register(c => { var rebusLoggerFactory = c.Get<IRebusLoggerFactory>(); var asyncTaskFactory = c.Get<IAsyncTaskFactory>(); return new AmazonSqsTransport(inputQueueAddress, accessKeyId, secretAccessKey, config, rebusLoggerFactory, asyncTaskFactory); }); configurer .OtherService<IPipeline>() .Decorate(p => { var pipeline = p.Get<IPipeline>(); return new PipelineStepRemover(pipeline) .RemoveIncomingStep(s => s.GetType() == typeof (HandleDeferredMessagesStep)); }); configurer.OtherService<ITimeoutManager>().Register(c => new DisabledTimeoutManager(), description: SqsTimeoutManagerText); }
public ISubscribeReponseMessage Subscribe(string queueUrl) { var sqsConfig = new AmazonSQSConfig {ServiceURL = SqsServiceUrl}; var snsConfig = new AmazonSimpleNotificationServiceConfig {ServiceURL = SnsServiceUrl}; using (var sqsClient = _awsConfig.CreateAwsClient<AmazonSQSClient>(sqsConfig)) { var attributesRequest = new GetQueueAttributesRequest(queueUrl, new List<string> {"QueueArn"}); var attributesResponse = sqsClient.GetQueueAttributes(attributesRequest); using (var snsClient = _awsConfig.CreateAwsClient<AmazonSimpleNotificationServiceClient>(snsConfig)) { var subribeResonse = snsClient.Subscribe(new SubscribeRequest(TopicArn, "sqs", attributesResponse.QueueARN)); } var actions = new ActionIdentifier[2]; actions[0] = SQSActionIdentifiers.SendMessage; actions[1] = SQSActionIdentifiers.ReceiveMessage; var sqsPolicy = new Policy().WithStatements( new Statement(Statement.StatementEffect.Allow).WithPrincipals(Principal.AllUsers) .WithResources( new Resource(attributesResponse.QueueARN)) .WithConditions( ConditionFactory.NewSourceArnCondition( TopicArn)) .WithActionIdentifiers(actions)); var setQueueAttributesRequest = new SetQueueAttributesRequest(); var attributes = new Dictionary<string, string> {{"Policy", sqsPolicy.ToJson()}}; var attRequest = new SetQueueAttributesRequest(attributesRequest.QueueUrl, attributes); sqsClient.SetQueueAttributes(attRequest); return new SubcriptionMessage("Ok"); } }
public CraneChatRequestSender() { // initialize Amazon SQSClient AmazonSQSConfig sqsConfig = new AmazonSQSConfig(); sqsConfig.ServiceURL = ConfigurationManager.AppSettings["SQSServiceURL"].ToString(); m_sqsClient = AWSClientFactory.CreateAmazonSQSClient(sqsConfig); // create 'Request' queue and save its URL if (null != m_sqsClient) { try { CreateQueueRequest createQueueRequest = new CreateQueueRequest().WithQueueName("Request"); CreateQueueResponse createQueueResponse = m_sqsClient.CreateQueue(createQueueRequest); m_requestQueueUrl = createQueueResponse.CreateQueueResult.QueueUrl; } catch (AmazonSQSException /*sqsException*/) { throw; } } }
/// <summary> /// Constructs AmazonSQSClient with AWS Access Key ID, AWS Secret Key and an /// AmazonSQS Configuration object. If the config object's /// UseSecureStringForAwsSecretKey is false, the AWS Secret Key /// is stored as a clear-text string. Please use this option only /// if the application environment doesn't allow the use of SecureStrings. /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> /// <param name="config">The AmazonSQS Configuration Object</param> public AmazonSQSClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonSQSConfig config) { if (!String.IsNullOrEmpty(awsSecretAccessKey)) { if (config.UseSecureStringForAwsSecretKey) { this.awsSecretAccessKey = new SecureString(); foreach (char ch in awsSecretAccessKey.ToCharArray()) { this.awsSecretAccessKey.AppendChar(ch); } this.awsSecretAccessKey.MakeReadOnly(); } else { clearAwsSecretAccessKey = awsSecretAccessKey; } } this.awsAccessKeyId = awsAccessKeyId; this.config = config; ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; }
/// <summary> /// Create a client for the Amazon SQS Service with the specified configuration /// </summary> /// <param name="awsAccessKey">The AWS Access Key associated with the account</param> /// <param name="awsSecretAccessKey">The AWS Secret Access Key associated with the account</param> /// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc /// </param> /// <returns>An Amazon SQS client</returns> /// <remarks> /// </remarks> public static IAmazonSQS CreateAmazonSQSClient( string awsAccessKey, string awsSecretAccessKey, AmazonSQSConfig config ) { return new AmazonSQSClient(awsAccessKey, awsSecretAccessKey, config); }
private OperationResult EstablishClient(AddonManifest manifest, DeveloperOptions devOptions, out AmazonSQSClient client) { OperationResult result; bool requireCreds; var manifestprops = manifest.GetProperties().ToDictionary(x=>x.Key, x=>x.Value); var AccessKey = manifestprops["AWSClientKey"]; var SecretAccessKey = manifestprops["AWSSecretKey"]; var _RegionEndpoint = manifestprops["AWSRegionEndpoint"]; var prop = manifest.Properties.First( p => p.Key.Equals("requireDevCredentials", StringComparison.InvariantCultureIgnoreCase)); if (bool.TryParse(prop.Value, out requireCreds) && requireCreds) { if (!ValidateDevCreds(devOptions)) { client = null; result = new OperationResult() { IsSuccess = false, EndUserMessage = "The add on requires that developer credentials are specified but none were provided." }; return result; } } AmazonSQSConfig config = new AmazonSQSConfig() { RegionEndpoint = RegionEndpoint.USEast1 }; client = new AmazonSQSClient(AccessKey, SecretAccessKey, config); result = new OperationResult { IsSuccess = true }; return result; }
/// <summary> /// Constructs AmazonSQSClient with AWS Credentials and an /// AmazonSQSClient Configuration object. /// </summary> /// <param name="credentials">AWS Credentials</param> /// <param name="clientConfig">The AmazonSQSClient Configuration Object</param> public AmazonSQSClient(AWSCredentials credentials, AmazonSQSConfig clientConfig) : base(credentials, clientConfig) { }
/// <summary> /// Constructs AmazonSQSClient with AWS Access Key ID, AWS Secret Key and an /// AmazonSQSClient Configuration object. /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> /// <param name="awsSessionToken">AWS Session Token</param> /// <param name="clientConfig">The AmazonSQSClient Configuration Object</param> public AmazonSQSClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonSQSConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig) { }
protected internal virtual AmazonSQS GetClient() { var config = new AmazonSQSConfig { ServiceURL = _serviceUrl, }; return (_client ?? (_client = Amazon.AWSClientFactory.CreateAmazonSQSClient(_accessKey, _secretKey, config))); }
/// <summary> /// Constructs an AmazonSQSClient with AWS Access Key ID, AWS Secret Key and an /// AmazonSQS Configuration object /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key as a SecureString</param> /// <param name="config">The AmazonSQS Configuration Object</param> public AmazonSQSClient(string awsAccessKeyId, SecureString awsSecretAccessKey, AmazonSQSConfig config) : this(new BasicAWSCredentials(awsAccessKeyId, awsSecretAccessKey), config, true) { }
private static HttpWebRequest ConfigureWebRequest(int contentLength, string queueUrl, AmazonSQSConfig config) { HttpWebRequest request = WebRequest.Create(queueUrl) as HttpWebRequest; if (request != null) { if (config.IsSetProxyHost() && config.IsSetProxyPort()) { WebProxy proxy = new WebProxy(config.ProxyHost, config.ProxyPort); if (config.IsSetProxyUsername()) { proxy.Credentials = new NetworkCredential(config.ProxyUsername, config.ProxyPassword ?? string.Empty); } request.Proxy = proxy; } request.UserAgent = config.UserAgent; request.Method = "POST"; request.Timeout = 0xc350; request.ContentType = "application/x-www-form-urlencoded; charset=utf-8"; request.ContentLength = contentLength; } return(request); }
private AmazonSQSClient(AWSCredentials credentials, AmazonSQSConfig config) { this.config = config; this.awsAccessKeyId = credentials.GetCredentials().AccessKey; this.clearAwsSecretAccessKey = credentials.GetCredentials().SecretKey; }
private static AmazonSQSClient GetClient() { string awsId = System.Configuration.ConfigurationManager.AppSettings["AWSId"].ToString(); string awsSecretKey = System.Configuration.ConfigurationManager.AppSettings["AWSSecretKey"].ToString(); AmazonSQSConfig config = new AmazonSQSConfig(); config.UserAgent = "Illuminate v0.2"; AmazonSQSClient client = new AmazonSQSClient(awsId, awsSecretKey, config); return client; }
public AmazonSQSClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonSQSConfig config) { this.awsAccessKeyId = awsAccessKeyId; this.awsSecretAccessKey = awsSecretAccessKey; this.config = config; }
/// <summary> /// Constructs AmazonSQSClient with the credentials loaded from the application's /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. /// /// Example App.config with credentials set. /// <code> /// <?xml version="1.0" encoding="utf-8" ?> /// <configuration> /// <appSettings> /// <add key="AWSProfileName" value="AWS Default"/> /// </appSettings> /// </configuration> /// </code> /// /// </summary> /// <param name="config">The AmazonSQSClient Configuration Object</param> public AmazonSQSClient(AmazonSQSConfig config) : base(FallbackCredentialsFactory.GetCredentials(), config) { }
/// <summary> /// Constructs AmazonSQSClient with AWSCredentials and an AmazonSQS Configuration object. /// </summary> /// <param name="credentials"></param> /// <param name="config"></param> public AmazonSQSClient(AWSCredentials credentials, AmazonSQSConfig config) : this(credentials, config, false) { }
/** * Configure HttpClient with set of defaults as well as configuration * from AmazonSQSConfig instance */ private static HttpWebRequest ConfigureWebRequest(int contentLength, string queueUrl, AmazonSQSConfig config) { HttpWebRequest request = WebRequest.Create(queueUrl) as HttpWebRequest; if (request != null) { if (config.IsSetProxyHost() && config.IsSetProxyPort()) { WebProxy proxy = new WebProxy(config.ProxyHost, config.ProxyPort); if (config.IsSetProxyUsername()) { proxy.Credentials = new NetworkCredential( config.ProxyUsername, config.ProxyPassword ?? String.Empty ); } request.Proxy = proxy; } request.UserAgent = config.UserAgent; request.Method = "POST"; request.Timeout = 50000; request.ContentType = AWSSDKUtils.UrlEncodedContent; request.ContentLength = contentLength; } return(request); }
/// <summary> /// Constructs AmazonSQSClient with AWS Access Key ID, AWS Secret Key and an /// AmazonSQSClient Configuration object. If the config object's /// UseSecureStringForAwsSecretKey is false, the AWS Secret Key /// is stored as a clear-text string. Please use this option only /// if the application environment doesn't allow the use of SecureStrings. /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> /// <param name="awsSessionToken">AWS Session Token</param> /// <param name="clientConfig">The AmazonSQSClient Configuration Object</param> public AmazonSQSClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonSQSConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig, AuthenticationTypes.User | AuthenticationTypes.Session) { }
/// <summary> /// Constructs AmazonSQSClient with the credentials loaded from the application's /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. /// /// Example App.config with credentials set. /// <code> /// <?xml version="1.0" encoding="utf-8" ?> /// <configuration> /// <appSettings> /// <add key="AWSAccessKey" value="********************"/> /// <add key="AWSSecretKey" value="****************************************"/> /// </appSettings> /// </configuration> /// </code> /// /// </summary> /// <param name="config">The AmazonSQS Configuration Object</param> public AmazonSQSClient(AmazonSQSConfig config) : base(FallbackCredentialsFactory.GetCredentials(), config, AuthenticationTypes.User | AuthenticationTypes.Session) { }
/// <summary> /// Constructs AmazonSQSClient with AWS Access Key ID, AWS Secret Key and an /// AmazonSQSClient Configuration object. /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> /// <param name="awsSessionToken">AWS Session Token</param> /// <param name="clientConfig">The AmazonSQSClient Configuration Object</param> public AmazonSQSClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonSQSConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig, AuthenticationTypes.User | AuthenticationTypes.Session) { }
/// <summary> /// Create a client for the Amazon SQS Service with the credentials loaded from the application's /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. /// /// Example App.config with credentials set. /// <code> /// <?xml version="1.0" encoding="utf-8" ?> /// <configuration> /// <appSettings> /// <add key="AWSAccessKey" value="********************"/> /// <add key="AWSSecretKey" value="****************************************"/> /// </appSettings> /// </configuration> /// </code> /// </summary> /// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc</param> /// <returns>An Amazon SQS client</returns> public static AmazonSQS CreateAmazonSQSClient(AmazonSQSConfig config) { return new AmazonSQSClient(config); }
// Constructs an AmazonSQSClient with credentials, config and flag which // specifies if the credentials are owned by the client or not private AmazonSQSClient(AWSCredentials credentials, AmazonSQSConfig config, bool ownCredentials) { this.credentials = credentials; this.config = config; this.ownCredentials = ownCredentials; }
/// <summary> /// Create a client for the Amazon SQS Service with AWSCredentials and an AmazonSQS Configuration object. /// </summary> /// <param name="credentials">AWS Credentials</param> /// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc</param> /// <returns>An Amazon SQS client</returns> /// <remarks> /// </remarks> public static IAmazonSQS CreateAmazonSQSClient(AWSCredentials credentials, AmazonSQSConfig config) { return new AmazonSQSClient(credentials, config); }
public SqsController() { var config = new AmazonSQSConfig(); config.ServiceURL = "https://sqs.eu-central-1.amazonaws.com/"; _client = new AmazonSQSClient(ConfigurationManager.AppSettings["AWSAccessKey"], ConfigurationManager.AppSettings["AWSSecretAccessKey"], config); }
/// <summary> /// Constructs AmazonSQSClient with AWS Credentials and an /// AmazonSQSClient Configuration object. /// </summary> /// <param name="credentials">AWS Credentials</param> /// <param name="clientConfig">The AmazonSQSClient Configuration Object</param> public AmazonSQSClient(AWSCredentials credentials, AmazonSQSConfig clientConfig) : base(credentials, clientConfig, AuthenticationTypes.User | AuthenticationTypes.Session) { }