示例#1
0
        public Handler(IDispatchMessages bus)
        {
            this.MapCorrelationIdFrom <MyEvent>(e => e.EntityId);
            this.MapCorrelationIdFrom <OtherEvent>(e => e.EntityId);
            this.MapCorrelationIdFrom <StartEvent>(e => e.EntityId);

            this.SagaCompletesWhen(t => t.Has("ev", "other"))
            .OnCompleteDo(d => bus.Send(new MyCommand()
            {
                SomeId      = d.Get <Guid>("started"),
                OperationId = d.Id
            }));
        }
 public static Task Send(this IDispatchMessages endpoint, Message[] messages, Guid?runId = null)
 => Task.WhenAll(messages.Select(m => endpoint.Send(m, runId)));