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); }
/// <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()); }
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))); } }
/// <inheritdoc cref="IEventInterceptor"/> public Task <CommandHandlingResult> InterceptAsync(IEventInterceptionContext context) { _eventLogger.Log(context.HandlerObject, context.Event); return(context.InvokeNextAsync()); }