示例#1
0
        protected virtual void ConnectToBroker()
        {
            if (Channel == null || Channel.IsClosed)
            {
                var connection = new MessageGatewayConnectionPool().GetConnection(_connectionFactory);

                Logger.DebugFormat("RMQMessagingGateway: Opening channel to Rabbit MQ on connection {0}", Configuration.AMPQUri.GetSanitizedUri());

                Channel = connection.CreateModel();

                //When AutoClose is true, the last channel to close will also cause the connection to close1. If it is set to
                //true before any channel is created, the connection will close then and there.
                if (connection.AutoClose == false)
                {
                    connection.AutoClose = true;
                }

                // Configure the Quality of service for the model.
                // BasicQos(0="Don't send me a new message until I?ve finished",  1= "Send me one message at a time", false ="Applied separately to each new consumer on the channel")
                Channel.BasicQos(0, Configuration.Queues.QosPrefetchSize, false);

                Logger.DebugFormat("RMQMessagingGateway: Declaring exchange {0} on connection {1}", Configuration.Exchange.Name, Configuration.AMPQUri.GetSanitizedUri());

                //desired state configuration of the exchange
                Channel.DeclareExchangeForConfiguration(Configuration);
            }
        }
        protected virtual void ConnectToBroker()
        {
            if (Channel == null || Channel.IsClosed)
            {
                var connection = new MessageGatewayConnectionPool().GetConnection(_connectionFactory);

                _logger.Value.DebugFormat("RMQMessagingGateway: Opening channel to Rabbit MQ on connection {0}", Connection.AmpqUri.GetSanitizedUri());

                Channel = connection.CreateModel();

                //When AutoClose is true, the last channel to close will also cause the connection to close1. If it is set to
                //true before any channel is created, the connection will close then and there.
                if (connection.AutoClose == false)
                {
                    connection.AutoClose = true;
                }

                _logger.Value.DebugFormat("RMQMessagingGateway: Declaring exchange {0} on connection {1}", Connection.Exchange.Name, Connection.AmpqUri.GetSanitizedUri());

                //desired state configuration of the exchange
                Channel.DeclareExchangeForConnection(Connection);
            }
        }
示例#3
0
        protected virtual void ConnectToBroker()
        {
            if (Channel == null || Channel.IsClosed)
            {
                var connection = new MessageGatewayConnectionPool().GetConnection(_connectionFactory);

                Logger.DebugFormat("RMQMessagingGateway: Opening channel to Rabbit MQ on connection {0}", Configuration.AMPQUri.GetSanitizedUri());

                Channel = connection.CreateModel();

                //When AutoClose is true, the last channel to close will also cause the connection to close1. If it is set to
                //true before any channel is created, the connection will close then and there.
                if (connection.AutoClose == false)
                {
                    connection.AutoClose = true;
                }

                // Configure the Quality of service for the model.
                // BasicQos(0="Don't send me a new message until I?ve finished",  1= "Send me one message at a time", false ="Applied separately to each new consumer on the channel")
                Channel.BasicQos(0, Configuration.Queues.QosPrefetchSize, false);

                Logger.DebugFormat("RMQMessagingGateway: Declaring exchange {0} on connection {1}", Configuration.Exchange.Name, Configuration.AMPQUri.GetSanitizedUri());

                //desired state configuration of the exchange
                Channel.DeclareExchangeForConfiguration(Configuration);
            }
        }
示例#4
0
        protected virtual void ConnectToBroker()
        {
            if (Channel == null || Channel.IsClosed)
            {
                var connection = new MessageGatewayConnectionPool().GetConnection(_connectionFactory);

                _logger.Value.DebugFormat("RMQMessagingGateway: Opening channel to Rabbit MQ on connection {0}", Connection.AmpqUri.GetSanitizedUri());

                Channel = connection.CreateModel();

                //When AutoClose is true, the last channel to close will also cause the connection to close1. If it is set to
                //true before any channel is created, the connection will close then and there.
                if (connection.AutoClose == false)
                {
                    connection.AutoClose = true;
                }

                _logger.Value.DebugFormat("RMQMessagingGateway: Declaring exchange {0} on connection {1}", Connection.Exchange.Name, Connection.AmpqUri.GetSanitizedUri());

                //desired state configuration of the exchange
                Channel.DeclareExchangeForConnection(Connection);
            }
        }