Ejemplo n.º 1
0
        static void ReceiveSingleOneWayMessage()
        {
            var connection = GetConnectionFactory().CreateConnection();
            var channel    = connection.CreateModel();

            channel.BasicQos(0, 1, false);
            var basicConsumer = new OneWayMessageReceiver(channel);

            channel.BasicConsume("pt.southbank.routing.queue", false, basicConsumer);
        }
Ejemplo n.º 2
0
        private static void ReceiveSingleOneWayMessage()
        {
            IConnection connection = GetConnectionFactoryUsingURI().CreateConnection();
            IModel      channel    = connection.CreateModel();

            //sets up the basic behaviour of message handling.
            //one message at a time  and we don’t want to process any additional messages until the actual one has been processed.
            //the prefetch size, sets the maximum size of for the messages fetched from the queue where 0 means there is no upper limit.
            //prefetch count, is the number of messages to be fetched from the queue at a time.
            //The boolean “global” parameter is set to false which means that the prefetch limits are valid for the current consumer only, not for the entire connection
            channel.BasicQos(0, 1, false);
            DefaultBasicConsumer basicConsumer = new OneWayMessageReceiver(channel);

            channel.BasicConsume("my.first.queue", false, basicConsumer);
        }
Ejemplo n.º 3
0
        private static void ReceiveSingleOneWayMessage()
        {
            ConnectionFactory connectionFactory = new ConnectionFactory();

            connectionFactory.Port        = 5672;
            connectionFactory.HostName    = "localhost";
            connectionFactory.UserName    = "******";
            connectionFactory.Password    = "******";
            connectionFactory.VirtualHost = "accounting";

            IConnection connection = connectionFactory.CreateConnection();
            IModel      channel    = connection.CreateModel();

            channel.BasicQos(0, 1, false);
            DefaultBasicConsumer basicConsumer = new OneWayMessageReceiver(channel);

            channel.BasicConsume("my.first.queue", false, basicConsumer);
        }