protected void CreateExchange(ExchangeConfiguration exchangeConfig)
        {
            if (exchangeConfig == null)
                throw new ArgumentNullException("exchangeConfig");
            if (Channel == null || Channel.IsClosed)
                throw new InvalidOperationException("Cannot create exchange - channel is closed or null.");

            Channel.ExchangeDeclare(
                exchangeConfig.Name, 
                exchangeConfig.ExchangeType,
                exchangeConfig.IsDurable,
                exchangeConfig.AutoDelete,
                null
                );
        }
Exemple #2
0
        protected void CreateExchange(ExchangeConfiguration exchangeConfig)
        {
            if (exchangeConfig == null)
            {
                throw new ArgumentNullException("exchangeConfig");
            }
            if (Channel == null || Channel.IsClosed)
            {
                throw new InvalidOperationException("Cannot create exchange - channel is closed or null.");
            }

            Channel.ExchangeDeclare(
                exchangeConfig.Name,
                exchangeConfig.ExchangeType,
                exchangeConfig.IsDurable,
                exchangeConfig.AutoDelete,
                null
                );
        }
        public RabbitPublisher(
            HostConfiguration hostConfig, 
            ExchangeConfiguration exchangeConfig, 
            bool messagesMustBeRouted,
            QueueConfiguration deadLetterQueueConfig
            ) 
        : base(hostConfig)
        {
            if (exchangeConfig == null)
                throw new ArgumentNullException("exchangeConfig");
            if (messagesMustBeRouted && deadLetterQueueConfig == null)
                throw new ArgumentNullException("deadLetterQueueConfig");

            _exchangeConfig = exchangeConfig;
            _messagesMustBeRouted = messagesMustBeRouted;
            _deadLetterQueueConfig = deadLetterQueueConfig;

            InitializeConnection();
        }
Exemple #4
0
        public RabbitPublisher(
            HostConfiguration hostConfig,
            ExchangeConfiguration exchangeConfig,
            bool messagesMustBeRouted,
            QueueConfiguration deadLetterQueueConfig
            )
            : base(hostConfig)
        {
            if (exchangeConfig == null)
            {
                throw new ArgumentNullException("exchangeConfig");
            }
            if (messagesMustBeRouted && deadLetterQueueConfig == null)
            {
                throw new ArgumentNullException("deadLetterQueueConfig");
            }

            _exchangeConfig        = exchangeConfig;
            _messagesMustBeRouted  = messagesMustBeRouted;
            _deadLetterQueueConfig = deadLetterQueueConfig;

            InitializeConnection();
        }