Exemple #1
0
 public SqsMessageProducerFactory(
     AWSMessagingGatewayConnection connection
     ) : this(connection, new SqsPublication {
     MakeChannels = OnMissingChannel.Create
 })
 {
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChannelFactory"/> class.
 /// </summary>
 /// <param name="awsConnection">The details of the connection to AWS</param>
 /// <param name="messageConsumerFactory">The messageConsumerFactory.</param>
 public ChannelFactory(
     AWSMessagingGatewayConnection awsConnection,
     SqsMessageConsumerFactory messageConsumerFactory)
 {
     _awsConnection          = awsConnection;
     _messageConsumerFactory = messageConsumerFactory;
 }
Exemple #3
0
 public SqsMessageProducerFactory(
     AWSMessagingGatewayConnection connection,
     SqsPublication sqsPublication)
 {
     _connection     = connection;
     _sqsPublication = sqsPublication;
 }
 /// <summary>
 /// Create a collection of producers from the publication information
 /// </summary>
 /// <param name="connection">The Connection to use to connect to AWS</param>
 /// <param name="snsPublications">The publication describing the SNS topic that we want to use</param>
 public SnsProducerRegistryFactory(
     AWSMessagingGatewayConnection connection,
     IEnumerable <SnsPublication> snsPublications)
 {
     _connection      = connection;
     _snsPublications = snsPublications;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SqsMessageProducer"/> class.
 /// </summary>
 /// <param name="connection">How do we connect to AWS in order to manage middleware</param>
 /// <param name="publication">Configuration of a producer</param>
 public SqsMessageProducer(AWSMessagingGatewayConnection connection, SqsPublication publication)
     : base(connection)
 {
     _connection            = connection;
     _topicArn              = EnsureTopic(new RoutingKey(publication.RoutingKey), publication.SnsAttributes, publication.MakeChannels);
     MaxOutStandingMessages = publication.MaxOutStandingMessages;
     MaxOutStandingCheckIntervalMilliSeconds = publication.MaxOutStandingMessages;
 }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SqsMessageConsumer"/> class.
 /// </summary>
 /// <param name="connection">The connection details used to connect to the SQS queue.</param>
 /// <param name="queueName">The name of the SQS Queue</param>
 /// <param name="batchSize">The maximum number of messages to consume per call to SQS</param>
 public SqsMessageConsumer(
     AWSMessagingGatewayConnection connection, 
     string queueName,
     int batchSize = 1)
 {
     _connection = connection;
     _queueName = queueName;
     _batchSize = batchSize;
 }
Exemple #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SqsMessageConsumer"/> class.
 /// </summary>
 /// <param name="awsConnection">The awsConnection details used to connect to the SQS queue.</param>
 /// <param name="queueName">The name of the SQS Queue</param>
 /// <param name="routingKey">the SNS Topic we subscribe to</param>
 /// <param name="batchSize">The maximum number of messages to consume per call to SQS</param>
 /// <param name="hasDLQ">Do we have a DLQ attached to this queue?</param>
 public SqsMessageConsumer(
     AWSMessagingGatewayConnection awsConnection,
     string queueName,
     RoutingKey routingKey,
     int batchSize = 1,
     bool hasDLQ   = false)
 {
     _awsConnection = awsConnection;
     _queueName     = queueName;
     _batchSize     = batchSize;
     _hasDlq        = hasDLQ;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SqsMessageProducer"/> class.
        /// </summary>
        /// <param name="connection">How do we connect to AWS in order to manage middleware</param>
        /// <param name="publication">Configuration of a producer</param>
        public SqsMessageProducer(AWSMessagingGatewayConnection connection, SnsPublication publication)
            : base(connection)
        {
            _connection  = connection;
            _publication = publication;

            if (publication.TopicArn != null)
            {
                ChannelTopicArn = publication.TopicArn;
            }

            MaxOutStandingMessages = publication.MaxOutStandingMessages;
            MaxOutStandingCheckIntervalMilliSeconds = publication.MaxOutStandingMessages;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ChannelFactory"/> class.
        /// </summary>
        /// <param name="awsConnection">The details of the subscription to AWS</param>
        public ChannelFactory(
            AWSMessagingGatewayConnection awsConnection)
            : base(awsConnection)
        {
            _messageConsumerFactory = new SqsMessageConsumerFactory(awsConnection);
            var delay = Backoff.LinearBackoff(TimeSpan.FromSeconds(2), retryCount: 3, factor: 2.0, fastFirst: true);

            _retryPolicy = Policy
                           .Handle <InvalidOperationException>()
                           .WaitAndRetry(new[]
            {
                TimeSpan.FromSeconds(1),
                TimeSpan.FromSeconds(5),
                TimeSpan.FromSeconds(10)
            });
        }
Exemple #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SqsMessageProducer"/> class.
        /// </summary>
        /// <param name="connection">How do we connect to AWS in order to manage middleware</param>
        /// <param name="publication">Configuration of a producer</param>
        public SqsMessageProducer(AWSMessagingGatewayConnection connection, SqsPublication publication)
            : base(connection)
        {
            _connection  = connection;
            _publication = publication;

            //If the user has already established these by external creation, copy them
            if (_publication.TopicArns != null && _publication.TopicArns.Keys.Any())
            {
                foreach (var key in _publication.TopicArns.Keys)
                {
                    _ensuredTopics.Add(key, _publication.TopicArns[key]);
                }
            }

            MaxOutStandingMessages = publication.MaxOutStandingMessages;
            MaxOutStandingCheckIntervalMilliSeconds = publication.MaxOutStandingMessages;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SqsMessageProducer"/> class.
 /// </summary>
 /// <param name="credentials">The credentials for the AWS account being used</param>
 public SqsMessageProducer(AWSMessagingGatewayConnection connection)
 {
     _connection = connection;
 }
Exemple #12
0
 public AWSMessagingGateway(AWSMessagingGatewayConnection awsConnection)
 {
     _awsConnection = awsConnection;
 }
Exemple #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SqsMessageConsumerFactory"/> class.
 /// </summary>
 public SqsMessageConsumerFactory(AWSMessagingGatewayConnection awsConnection)
 {
     _awsConnection = awsConnection;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SqsMessageProducer"/> class.
 /// </summary>
 /// <param name="connection">How do we connect to AWS in order to manage middleware</param>
 /// <param name="publication">Configuration of a producer</param>
 public SqsMessageProducer(AWSMessagingGatewayConnection connection, SqsPublication publication)
     : base(connection)
 {
     _connection = connection;
     _topicArn   = EnsureTopic(new RoutingKey(publication.RoutingKey), publication.SnsAttributes, publication.MakeChannels);
 }
Exemple #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SqsMessageConsumer"/> class.
 /// </summary>
 /// <param name="connection">The connection details used to connect to the SQS queue.</param>
 /// <param name="queueName">The name of the SQS Queue</param>
 public SqsMessageConsumer(AWSMessagingGatewayConnection connection, string queueName)
 {
     _connection = connection;
     _queueName  = queueName;
 }