예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RmqMessageGateway" /> class.
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="queueName">The queue name.</param>
 /// <param name="routingKeys">The routing keys.</param>
 /// <param name="isDurable">Is the queue persisted to disk</param>
 /// <param name="highAvailability">Are the queues mirrored across nodes of the cluster</param>
 /// <param name="batchSize">How many messages to retrieve at one time; ought to be size of channel buffer</param>
 /// <param name="deadLetterQueueName">The dead letter queue</param>
 /// <param name="deadLetterRoutingKey">The routing key for dead letter messages</param>
 /// <param name="ttl">How long before a message on the queue expires in milliseconds. Defaults to infinite</param>
 /// <param name="maxQueueLength">The maximum number of messages on the queue before we begin to reject publication of messages</param>
 /// <param name="makeChannels">Should we validate or create missing channels</param>
 public RmqMessageConsumer(RmqMessagingGatewayConnection connection,
                           string queueName,
                           string[] routingKeys,
                           bool isDurable,
                           bool highAvailability       = false,
                           int batchSize               = 1,
                           string deadLetterQueueName  = null,
                           string deadLetterRoutingKey = null,
                           int?ttl                       = null,
                           int?maxQueueLength            = null,
                           OnMissingChannel makeChannels = OnMissingChannel.Create)
     : base(connection)
 {
     _queueName            = queueName;
     _routingKeys          = new RoutingKeys(routingKeys);
     _isDurable            = isDurable;
     _highAvailability     = highAvailability;
     _messageCreator       = new RmqMessageCreator();
     _batchSize            = Convert.ToUInt16(batchSize);
     _makeChannels         = makeChannels;
     _consumerTag          = Connection.Name + Guid.NewGuid();
     _deadLetterQueueName  = deadLetterQueueName;
     _deadLetterRoutingKey = deadLetterRoutingKey;
     _hasDlq         = !string.IsNullOrEmpty(deadLetterQueueName) && !string.IsNullOrEmpty(_deadLetterRoutingKey);
     _ttl            = ttl;
     _maxQueueLength = maxQueueLength;
 }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RMQMessageGateway" /> class.
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="queueName">The queue name.</param>
 /// <param name="routingKeys">The routing keys.</param>
 /// <param name="isDurable">Is the queue persisted to disk</param>
 /// <param name="highAvailability"></param>
 public RmqMessageConsumer(
     RmqMessagingGatewayConnection connection,
     string queueName,
     string[] routingKeys,
     bool isDurable,
     bool highAvailability = false)
     : base(connection)
 {
     _queueName   = queueName;
     _routingKeys = new RoutingKeys(routingKeys);
     _isDurable   = isDurable;
     IsQueueMirroredAcrossAllNodesInTheCluster = highAvailability;
     _messageCreator = new RmqMessageCreator();
 }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RMQMessageGateway" /> class.
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="queueName">The queue name.</param>
 /// <param name="routingKey">The routing key.</param>
 /// <param name="isDurable">Is the queue persisted to disk</param>
 /// <param name="preFetchSize">0="Don't send me a new message until I?ve finished",  1= "Send me one message at a time", n = number to grab (take care with competing consumers)</param>
 /// <param name="highAvailability"></param>
 public RmqMessageConsumer(
     RmqMessagingGatewayConnection connection,
     string queueName,
     string routingKey,
     bool isDurable,
     ushort preFetchSize   = 1,
     bool highAvailability = false)
     : base(connection)
 {
     _queueName    = queueName;
     _routingKey   = routingKey;
     _isDurable    = isDurable;
     _preFetchSize = preFetchSize;
     IsQueueMirroredAcrossAllNodesInTheCluster = highAvailability;
     _messageCreator = new RmqMessageCreator();
 }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RMQMessageGateway" /> class.
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="queueName">The queue name.</param>
 /// <param name="routingKeys">The routing keys.</param>
 /// <param name="isDurable">Is the queue persisted to disk</param>
 /// <param name="highAvailability"></param>
 public RmqMessageConsumer(
     RmqMessagingGatewayConnection connection,
     string queueName,
     string[] routingKeys,
     bool isDurable,
     bool highAvailability = false,
     int batchSize         = 1)
     : base(connection, batchSize)
 {
     _queueName   = queueName;
     _routingKeys = new RoutingKeys(routingKeys);
     _isDurable   = isDurable;
     IsQueueMirroredAcrossAllNodesInTheCluster = highAvailability;
     _messageCreator = new RmqMessageCreator();
     _batchSize      = batchSize;
     _consumerTag    = Connection.Name + Guid.NewGuid();
 }