public async Task ProcessAsync(IInvocationContext context, Message message) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (message == null) { throw new ArgumentNullException(nameof(message)); } var messageContext = new MessageInvocationContext(context.Principal, message, this); // when messages arrive through the listener there is not difference between // messages and queries, since the result should be delivered over the queue. if (IsQuery(message.Body)) { await InvokeQueryHandler(messageContext, message); } else { await InvokeMessageHandlers(messageContext, message); } // someone else is taking care of the outbound messages if (_outboundMessageRouter != null) { Logger?.Invoke(LogLevel.Debug, "", "Invoking IOutboundMessageRouter."); await _outboundMessageRouter.SendAsync(messageContext); } foreach (var msg in messageContext.OutboundMessages) { Logger?.Invoke(LogLevel.Info, message.MessageId.ToString("N"), $"Sending {msg.Body.GetType()}"); await context.SendAsync(msg); } foreach (var msg in messageContext.Replies) { Logger?.Invoke(LogLevel.Info, message.MessageId.ToString("N"), $"Replying with {msg.Body.GetType()}"); await context.ReplyAsync(msg); } }
public void OnLogRecieved(ProgressChangedEventArgs e) { LoggerHandler?.Invoke(this, e); }
protected void SendLogMessage(string msg) { LoggerHandler?.Invoke(this, msg); }