async Task Execute(BehaviorContext <TInstance> context) { ConsumeEventContext <TInstance> consumeContext = context.CreateConsumeContext(); var message = await _asyncMessageFactory(consumeContext).ConfigureAwait(false); ITopicProducer <TMessage> producer = context.GetProducer <TMessage>(); await producer.Produce(message, _pipe).ConfigureAwait(false); }
async Task Execute(BehaviorContext <TInstance> context) { ConsumeEventContext <TInstance> consumeContext = context.CreateConsumeContext(); var message = await _asyncMessageFactory(consumeContext).ConfigureAwait(false); var producer = await context.GetProducer(consumeContext, _nameProvider(consumeContext)); await producer.Produce(message, _pipe).ConfigureAwait(false); }
async Task Faulted(BehaviorContext <TInstance> context) { if (context.TryGetExceptionContext(out ConsumeExceptionEventContext <TInstance, TException> exceptionContext)) { var message = await _asyncMessageFactory(exceptionContext).ConfigureAwait(false); var producer = await context.GetProducer(exceptionContext, _nameProvider(exceptionContext)); await producer.Produce(message, _pipe).ConfigureAwait(false); } }