Пример #1
0
 public async Task HandleAsync(TEvent @event, ICorrelationContext context)
 {
     if (@event.BelongsToSaga())
     {
         var sagaContext = SagaContext.CreateFromCorrelationContext(context);
         await sagaCoordinator.ProcessAsync(@event, sagaContext);
     }
 }
Пример #2
0
 public async Task PublishAsync <TEvent>(TEvent @event, ICorrelationContext context) where TEvent : IEvent
 {
     if (@event.BelongsToSaga())
     {
         var sagaContext = SagaContext.CreateFromCorrelationContext(context);
         await sagaCoordinator.ProcessAsync(@event, sagaContext);
     }
     else
     {
         await busClient.PublishAsync(@event, ctx => ctx.UseMessageContext(context));
     }
 }