Ejemplo n.º 1
0
        public async Task <IDispatchResult> HandleAsync(LogCommand message)
        {
            var str = message.Components.Aggregate((e, n) => e + " " + n);

            // We use the service that is injected into out constructor.
            await _logger?.LogToConsoleAsync(str);

            var evt = new LoggedEvent(str);

            // We use the MessageDispatcher that is injected into our handler to publish an event.
            var dispatchResult = await MessageDispatcher.DispatchAsync(evt, publish : true);

            // We return the dispatch result of the dispatch to forward any failures to the caller.
            return(dispatchResult);
        }