Beispiel #1
0
        public RabbitMqDialogue(RabbitMqProducer eventChannel, RabbitMqProducer responseChannel,
                                RabbitMqConsumer requestChannel, Guid dialogueId, IConnection dialogueConnection)
        {
            _eventChannel       = eventChannel;
            _responseChannel    = responseChannel;
            _requestChannel     = requestChannel;
            _dialogueConnection = dialogueConnection;
            DialogueId          = dialogueId;
            Created             = DateTime.Now;

            // Attach to Consumer Channel
            _requestChannel.StartConsumer(OnDequeue, OnError);
        }
Beispiel #2
0
 protected void OnDequeue(string message, RabbitMqConsumer sender, ulong deliveryTag)
 {
     Logger.Trace("Receiving request from dialogue {0}: {1}", DialogueId, message);
     if (OnNewCommandRequest == null)
     {
         return;
     }
     try
     {
         OnNewCommandRequest(this, JsonConvert.DeserializeObject <Command>(message));
     }
     catch (Exception ex)
     {
         Logger.Error("Error processing OnNewCommandRequest", ex);
     }
 }
Beispiel #3
0
 protected void OnError(Exception ex, RabbitMqConsumer sender, ulong deliveryTag)
 {
     Logger.Error("RabbitMq Consumer Error", ex);
 }