Exemple #1
0
        IDictionary AddDeadLetterArguments(IDictionary exchangeArguments)
        {
            IDictionary queueDeclareArgs = exchangeArguments;

            IDeadLetterConfiguration deadLetterConfig = _consumeInfo.DeadLetterConfiguration ?? _defaultDeadLetterConfiguration;

            if (deadLetterConfig != null)
            {
                string deadLetterExchangeName = deadLetterConfig.ExchangeName;
                string deadLetterRoutingKey   = deadLetterConfig.RoutingKey;

                if (exchangeArguments == null)
                {
                    queueDeclareArgs = new Dictionary <string, object>();
                }

                queueDeclareArgs.Add("x-dead-letter-exchange", deadLetterExchangeName);

                if (!string.IsNullOrWhiteSpace(deadLetterRoutingKey))
                {
                    queueDeclareArgs.Add("x-dead-letter-routing-key", deadLetterRoutingKey);
                }
            }
            return(queueDeclareArgs);
        }
        public MessagePublisher(string userName,
                                IDeadLetterConfiguration defaultDeadLetterConfiguration,
                                IRouteConfiguration <IPublishInfo> publishRouteConfiguration,
                                IRouteConfiguration <IConsumeInfo> consumeRouteConfiguration,
                                ISerializationStrategy defaultSerializationStrategy,
                                IQueueStrategy queueStrategy)
        {
            _userName = userName;
            _defaultDeadLetterConfiguration = defaultDeadLetterConfiguration;

            _publishRouteConfiguration    = publishRouteConfiguration;
            _consumeRouteConfiguration    = consumeRouteConfiguration;
            _defaultSerializationStrategy = defaultSerializationStrategy;
            _queueStrategy = queueStrategy;
        }
Exemple #3
0
 public Subscription(IConnection connection, IDeadLetterConfiguration defaultDeadLetterConfiguration,
                     ISerializationStrategy defaultSerializationStrategy, IConsumeInfo consumeInfo,
                     string routingKey,
                     Action <IMessageContext <TMessage> > callback, IDictionary queueProperties,
                     Action <IErrorContext> defaultErrorCallback, IMessagePublisher messagePublisher,
                     SubscriptionType subscriptionType, TimeSpan callbackTimeout)
 {
     _connection = connection;
     _defaultDeadLetterConfiguration = defaultDeadLetterConfiguration;
     _defaultSerializationStrategy   = defaultSerializationStrategy;
     _consumeInfo          = consumeInfo;
     _routingKey           = routingKey ?? _consumeInfo.DefaultRoutingKey;
     _callback             = callback;
     _defaultErrorCallback = defaultErrorCallback;
     _messagePublisher     = messagePublisher;
     _subscriptionType     = subscriptionType;
     _callbackTimeout      = callbackTimeout;
     _queueProperties      = queueProperties;
 }