public async Task Handle(Message message, IMessageHandlerContext context) { var batchPolicy = Policy .Handle <Exception>(ex => true) .RetryAsync(1, (exception, retryAttempt, context) => { _numberOfOverriddenBatchPollyRetries++; }); context.OverrideBatchDispatchRetryPolicy(batchPolicy); var immediatePolicy = Policy .Handle <Exception>(ex => true) .RetryAsync(1, (exception, retryAttempt, context) => { _numberOfOverriddenImmediatePollyRetries++; }); context.OverrideBatchDispatchRetryPolicy(batchPolicy); context.OverrideImmediateDispatchRetryPolicy(immediatePolicy); var options = new ReplyOptions(); options.RequireImmediateDispatch(); await context.Reply(new ReplyMessage(), options); await context.Reply(new AnotherReplyMessage()); }
public Task Handle(Message message, IMessageHandlerContext context) { var options = new ReplyOptions(); options.RequireImmediateDispatch(); return(context.Reply(new ReplyMessage(), options)); }
public async Task Handle(Message message, IMessageHandlerContext context) { var options = new ReplyOptions(); options.RequireImmediateDispatch(); await context.Reply(new ReplyMessage(), options); await context.Reply(new AnotherReplyMessage()); }
public Task Handle(Message message, IMessageHandlerContext context) { var policy = Policy .Handle <Exception>(ex => true) .RetryAsync(1, (exception, retryAttempt, context) => { _numberOfOverriddenPollyRetries++; }); context.OverrideImmediateDispatchRetryPolicy(policy); var options = new ReplyOptions(); options.RequireImmediateDispatch(); return(context.Reply(new ReplyMessage(), options)); }