/// <summary> /// Used to create a new instance of the MessageGears client. /// </summary> /// <param name="props"> /// Contains the credentials needed to access MessageGears, Amazon S3, and Amazon SQS.<see cref="MessageGearsProperties"/> /// </param> public MessageGearsAwsClient(MessageGearsAwsProperties props) { this.properties = props; this.sqs = new AmazonSQSClient(properties.MyAWSAccountKey, properties.MyAWSSecretKey); this.s3 = new AmazonS3Client(properties.MyAWSAccountKey, properties.MyAWSSecretKey); log.Info("MessageGears AWS client initialized"); }
/// <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); }