Exemplo n.º 1
0
 /// <summary>
 /// Отправка сообщения в очередь нераспределенных книг
 /// </summary>
 /// <param name="e">Сообщение RabbitMQ</param>
 public void PublishUnallocatedQueue(BasicDeliverEventArgs e)
 {
     try
     {
         ChannelBook.BasicPublish(ExchangeBook, RoutingUnallocated, null, e.Body);
     }
     catch (Exception exception)
     {
         Log.Error(exception.ToString);
         StopApplication();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Запуск прослушивания очередей
 /// </summary>
 public void StartListeningQueues()
 {
     try
     {
         ChannelClient.BasicConsume(QueueClient, false, ConsumerClient);
         ChannelBook.BasicConsume(QueueBook, false, ConsumerBook);
     }
     catch (Exception exception)
     {
         Log.Error(exception.ToString);
         StopApplication();
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Конструктор объекта работы с RabbitMQ
        /// </summary>
        /// <param name="serverDB">Объект управления сервером</param>
        public RabbitmqSDB(ControlServerDB serverDB)
            : base()
        {
            ServerDB = serverDB;
            InitializationStringComponentSDB();

            try
            {
                ChannelBook.QueueDeclare(QueueUnallocated, true, false, false, null);
                ChannelBook.QueueBind(QueueUnallocated, ExchangeBook, RoutingUnallocated, null);

                ConsumerBook   = new EventingBasicConsumer(ChannelBook);
                ConsumerClient = new EventingBasicConsumer(ChannelClient);
            }
            catch (Exception exception)
            {
                Log.Error(exception.ToString);
                StopApplication();
            }

            InitializationMethodsConsumers();
        }