示例#1
0
 protected override void ConsumeMessage(IMessageReply reply)
 {
     base.ConsumeMessage(reply);
     if (_isDistributor)
     {
         _commandDistributor.EnqueueMessage(new MessageHandledNotification(reply.MessageID).GetFrame());
     }
 }
示例#2
0
        protected override Task SendAsync(IMessageContext commandContext, CancellationToken cancellationToken)
        {
            MessageState commandState = BuildMessageState(commandContext, cancellationToken);

            commandState.CancellationToken.Register(OnCancel, commandState);
            CommandStateQueue.Add(commandState.MessageID, commandState);
            Task.Factory.StartNew(() => {
                _commandConsumer.EnqueueMessage(commandContext.GetFrame());
                _Logger.InfoFormat("send to distributor/consumer commandID:{0} payload:{1}",
                                   commandContext.MessageID, commandContext.ToJson());
            });
            return(commandState.TaskCompletionSource.Task);
        }