public ISagaModel Build() { builder. Name(nameof(ChildStepsSagaBuilder)); builder. Start <SagaCreateWithDoStepEvent>(). Do(b => b. Then <InnerActivity1>(). Do(b => b. Then <InnerActivity2>()). Then <InnerActivity3>()). TransitionTo <Init>(); builder. Start <SagaCreateWithIfStepEvent>(). Then <InnerActivity1>(). If <Condition1>(b => b. Then <InnerActivity1>(). Then <InnerActivity3>()). TransitionTo <Init>(); return(builder. Build()); }
public ISagaModel Build() { builder. Name(nameof(SendTestsBuilder)); builder. Start <SendCreateEvent>(). TransitionTo <Init>(); builder. Start <SendAlternativeCreateEvent>(). TransitionTo <AkternativeInit>(); builder. During <Init>(). When <TestSendActionEvent>(). Publish <SendAlternativeCreateEvent>((ctx, ev) => ctx.Data.CreatedSagaID = ev.ID = Guid.NewGuid()). TransitionTo <AfterInit>(); return(builder. Build()); }
public ISagaModel Build() { builder. Start <CreatedEvent>(). HandleBy <CreatedEventHandler>("CreatedEventStep0"). ThenAsync( "CreatedEventStep1", ctx => Task.Delay(TimeSpan.FromSeconds(1))). Then( "CreatedEventStep2", ctx => Task.Delay(TimeSpan.FromSeconds(1))). Finish(); return(builder. Build()); }
public ISagaModel Build() { builder. Start <CreatedEvent, CreatedEventHandler>(). ThenAsync(ctx => Task.Delay(TimeSpan.FromSeconds(1))). TransitionTo <New>(); builder. During <New>(). When <UpdatedEvent>(). HandleBy <UpdatedEventHandler>(). ThenAsync(ctx => Task.Delay(TimeSpan.FromSeconds(5))). Finish(); return(builder. Build()); }
public ISagaModel Build() { builder. Name(nameof(TransitionsSagaBuilder)); builder. Start <CreateEvent>(). TransitionTo <Init>(); builder. During <Init>(). When <InvalidUpdateEvent>(). TransitionTo <SecondState>(). Then(ctx => { throw new Exception(); }). // RetryBy<InvalidUpdateEvent>(). Finish(); return(builder. Build()); }
public ISagaModel Build() { builder. Name(nameof(OrderSagaBuilder)); builder. Start <OrderCreatedEvent, OrderCreatedEventHandler>("OrderCreatedEventStep0"). Then("OrderCreatedEventStep1", ctx => Task.CompletedTask). TransitionTo <StateCreated>(); builder. During <StateCreated>(). When <OrderCompletedEvent>(). Then("OrderCompletedEventStep1", ctx => Task.CompletedTask). Then <SendEmailToClientEvent>("email"). Then <SendMessageToTheManagerEvent>("SendMessageToTheManagerEventStep"). Then <OrderCourierEvent>("OrderCourierEventStep"). TransitionTo <StateCompleted>(); builder. During <StateCompleted>(). When <OrderSendEvent>(). Then("OrderSendEventStep1", ctx => Task.CompletedTask). TransitionTo <StateOrderSend>(); builder. During <StateOrderSend>(). When <DeliveredEvent>(). Then("DeliveredEventStep1", ctx => Task.CompletedTask). Finish(); builder. During <StateCreated>(). When <ToAlternative1Event>(). TransitionTo <StateAlternative1>(). When <ToAlternative2Event>(). TransitionTo <StateAlternative2>(); return(builder. Build()); }
public ISagaModel Build() { builder. Name(nameof(InvalidSagaBuilder)); builder. Start <InvalidCreatedEvent, InvalidCreatedEventHandler>(). ThenAsync( "InvalidCreatedEvent1", ctx => Task.CompletedTask, ctx => Task.CompletedTask). Then( "InvalidCreatedEvent2", ctx => throw new TestSagaException("error"), ctx => Task.CompletedTask). Finish(); builder. Start <ValidCreatedEvent, ValidCreatedEventHandler>(). TransitionTo <StateCreated>(); builder. During <StateCreated>(). When <InvalidUpdateEvent>(). ThenAsync( "InvalidUpdateEvent1", ctx => Task.CompletedTask, ctx => Task.CompletedTask). Then( "InvalidUpdateEvent2", ctx => Task.CompletedTask, ctx => Task.CompletedTask). Then( "InvalidUpdateEvent3", ctx => throw new TestSagaException("error"), ctx => Task.CompletedTask). Finish(); builder. During <StateCreated>(). When <InvalidCompensationEvent>(). ThenAsync( "InvalidCompensationEventStep1", ctx => Task.CompletedTask, ctx => Task.CompletedTask). Then( "InvalidCompensationEventStep2", ctx => Task.CompletedTask, ctx => Task.CompletedTask). Then( "InvalidCompensationEventStep3", ctx => throw new TestSagaException("error"), ctx => throw new TestCompensationException("compensation error")). Finish(); builder. During <StateCreated>(). When <ValidUpdateEvent>(). TransitionTo <StateUpdated>(); return(builder. Build()); }