public Func <Message, bool> WrapMessageHandler <T>(Func <IHandler <T> > futureHandler) where T : Message
        {
            IHandler <T> handler = new FutureHandler <T>(futureHandler);

            handler = MaybeWrapWithGuaranteedDelivery(futureHandler, handler);
            handler = MaybeWrapStopwatch(handler);

            return(message => handler.Handle((T)message));
        }
Beispiel #2
0
        public Func <Message, Task <bool> > WrapMessageHandler <T>(Func <IHandlerAsync <T> > futureHandler) where T : Message
        {
            IHandlerAsync <T> handler = new FutureHandler <T>(futureHandler);

            handler = MaybeWrapWithGuaranteedDelivery(futureHandler, handler);
            handler = MaybeWrapStopwatch(handler);

            return(async message => await handler.Handle((T)message).ConfigureAwait(false));
        }