Exemplo n.º 1
0
    protected override async Task <bool> RunInnerAsync(
        HandleMessageContext context,
        Func <CancellationToken, Task <bool> > func,
        CancellationToken stoppingToken)
    {
        if (context == null)
        {
            throw new ArgumentNullException(nameof(context));
        }

        return(await _func(context.MessageAs <TMessage>()));
    }
Exemplo n.º 2
0
    protected override async Task <bool> RunInnerAsync(
        HandleMessageContext context,
        Func <CancellationToken, Task <bool> > func,
        CancellationToken stoppingToken)
    {
        if (context == null)
        {
            throw new ArgumentNullException(nameof(context));
        }

        stoppingToken.ThrowIfCancellationRequested();

        var resolutionContext = new HandlerResolutionContext(context.QueueName);

        IHandlerAsync <T> handler = _handlerResolver(resolutionContext);

        return(await handler.Handle(context.MessageAs <T>()).ConfigureAwait(false));
    }
Exemplo n.º 3
0
    protected override async Task <bool> RunInnerAsync(HandleMessageContext context, Func <CancellationToken, Task <bool> > func, CancellationToken stoppingToken)
    {
        await Handler.Handle(context.MessageAs <TMessage>()).ConfigureAwait(false);

        return(true);
    }