Example #1
0
        private void WorkQueue()
        {
            rmq.CreateFanoutExchange(WORK_EXCHANGE, true, false);


            var queueArgs = new Dictionary <string, object> {
                { "x-dead-letter-exchange", RETRY_EXCHANGE }, { "x-message-ttl", RETRY_DELAY }
            };

            rmq.CreateQueue(WORK_QUEUE, true, false, queueArgs);
            rmq.BindQueue(WORK_QUEUE, WORK_EXCHANGE, "");
            try
            {
                var consumer = rmq.ConsumerEventHandlers();
                consumer.Received += Consumer_Received;
                rmq.Consume(WORK_QUEUE, false, consumer);
            }
            catch (Exception ex)
            {
            }
        }
Example #2
0
        private void RabbitMQSubscription()
        {
            RabbitMQConnectionFactory rmqConn = RabbitMQConnectionFactory.RabbitMQConnectionFactoryInstance;

            rmqConn.CreateDirectExchange("Events", false, true);

            rmqConn.CreateQueue("EventsQueue", false, true, null);
            rmqConn.BindQueue("EventsQueue", "Events", "UserCreatedEvent");
            try
            {
                var consumer = rmqConn.ConsumerEventHandlers();
                consumer.Received += Consumer_Received;
                rmqConn.Consume("EventsQueue", true, consumer);
            }
            catch (Exception ex)
            {
            }
        }
Example #3
0
        private void RabbitMQ()
        {
            RabbitMQConnectionFactory rmq = RabbitMQConnectionFactory.RabbitMQConnectionFactoryInstance;

            rmq.CreateFanoutExchange("SendMessages", false, true);
            rmq.CreateQueue("A", false, true);
            rmq.BindQueue("A", "SendMessages", "");


            try
            {
                var consumer = rmq.ConsumerEventHandlers();
                consumer.Received += Consumer_Received;
                rmq.Consume("A", true, consumer);
            }
            catch (Exception ex)
            {
            }
        }