Esempio n. 1
0
        public IAsyncMessageHandler <TMessage> CreateAsyncMessageHandler <TMessage>(IAsyncMessageHandler <TMessage> handler, AsyncMessageHandlerFilter <TMessage>[] filters)
        {
            var(globalLength, globalFilters)   = options.GetGlobalAsyncMessageHandlerFilters(provider, typeof(TMessage));
            var(handlerLength, handlerFilters) = filterProvider.GetAttributeFilters(handler.GetType(), provider);

            if (filters.Length != 0 || globalLength != 0 || handlerLength != 0)
            {
                handler = new FilterAttachedAsyncMessageHandler <TMessage>(handler, globalFilters.Concat(handlerFilters).Concat(filters).Cast <AsyncMessageHandlerFilter <TMessage> >());
            }

            return(handler);
        }
Esempio n. 2
0
        private async Task RunAsyncMessageHandler(IAsyncMessageHandler handler, BasicDeliverEventArgs eventArgs, string matchingRoute)
        {
            ValidateMessageHandler(handler);
            _logger.LogDebug($"Starting processing the message by async message handler {handler.GetType().Name}");
            await handler.Handle(eventArgs, matchingRoute);

            _logger.LogDebug($"The message has been processed by async message handler {handler.GetType().Name}");
        }
Esempio n. 3
0
        private async Task RunAsyncMessageHandler(IAsyncMessageHandler handler, MessageHandlingContext context, string matchingRoute)
        {
            ValidateMessageHandler(handler);
            _loggingService.LogDebug($"Starting processing the message by async message handler {handler.GetType().Name}");
            await handler.Handle(context, matchingRoute);

            _loggingService.LogDebug($"The message has been processed by async message handler {handler.GetType().Name}");
        }
        async Task RunAsyncHandler(IAsyncMessageHandler handler, string message, string routingKey)
        {
            _logger.LogDebug($"Starting processing the message by async message handler {handler?.GetType().Name}.");
            await handler.Handle(message, routingKey);

            _logger.LogDebug($"The message has been processed by async message handler {handler?.GetType().Name}.");
        }