public Task <CommandHandlingResult> InterceptAsync(IEventInterceptionContext context)
        {
            Intercepted           = true;
            InterceptionTimestamp = DateTime.UtcNow;

            return(context.InvokeNextAsync());
        }
        public async Task <CommandHandlingResult> InterceptAsync(IEventInterceptionContext context)
        {
            var commandType = context.Event.GetType();
            var result      = await _cqrsAwaiter.InterceptAsync(commandType, async() =>
            {
                return(await context.InvokeNextAsync());
            });

            return(result);
        }
 public async Task <CommandHandlingResult> InterceptAsync(IEventInterceptionContext context)
 {
     return(await CommonInterceptionLogic.InterceptAsync(
                _messageCancellationRegistry,
                _messageCancellationService,
                _log,
                context.Event,
                context.HandlerObject,
                context.InvokeNextAsync));
 }
예제 #4
0
        /// <inheritdoc cref="IEventInterceptor"/>
        public Task <CommandHandlingResult> InterceptAsync(IEventInterceptionContext context)
        {
            if (_customLoggingActionsMap.TryGetValue(context.Event.GetType(), out var customLoggingAction))
            {
                customLoggingAction?.Invoke(_defaultLogger, context.HandlerObject, context.Event);
            }
            else
            {
                _defaultLogger.Log(context.HandlerObject, context.Event);
            }

            return(context.InvokeNextAsync());
        }
예제 #5
0
        public async Task <CommandHandlingResult> InterceptAsync(IEventInterceptionContext context)
        {
            try
            {
                var result = await context.InvokeNextAsync();

                return(result);
            }
            catch (UnexpectedEventException ex)
            {
                _log.Warning($"{nameof(UnexpectedEventException)} handled", ex);
                return(CommandHandlingResult.Fail(TimeSpan.FromSeconds(10)));
            }
        }
예제 #6
0
        /// <inheritdoc cref="IEventInterceptor"/>
        public Task <CommandHandlingResult> InterceptAsync(IEventInterceptionContext context)
        {
            _eventLogger.Log(context.HandlerObject, context.Event);

            return(context.InvokeNextAsync());
        }
예제 #7
0
 public Task <CommandHandlingResult> InterceptAsync(IEventInterceptionContext context)
 {
     return(Task.FromResult(_actualHandler.Invoke(context.Event, context.CommandSender)));
 }