AsyncDolls.Pipeline.Incoming.LoadMessageHandlersStep.Invoke C# (CSharp) Method

Invoke() public method

public Invoke ( AsyncDolls.Pipeline.Incoming.IncomingLogicalContext context, IBusForHandler bus, Func next ) : System.Threading.Tasks.Task
context AsyncDolls.Pipeline.Incoming.IncomingLogicalContext
bus IBusForHandler
next Func
return System.Threading.Tasks.Task
        public async Task Invoke(IncomingLogicalContext context, IBusForHandler bus, Func<Task> next)
        {
            var messageType = context.LogicalMessage.Instance.GetType();

            var handlers = registry.GetHandlers(messageType);

            foreach (var handler in handlers)
            {
                var messageHandler = new MessageHandler
                {
                    Instance = handler,
                    Invocation = (handlerInstance, message) => registry.InvokeHandle(handlerInstance, message, bus)
                };

                context.Handler = messageHandler;

                await next()
                    .ConfigureAwait(false);

                if (context.HandlerInvocationAbortPending)
                {
                    break;
                }
            }
        }
    }
LoadMessageHandlersStep