public InMemorySagaConsumeContext(ConsumeContext <TMessage> context, SagaInstance <TSaga> instance, IndexedSagaDictionary <TSaga> sagas) : base(context) { _sagas = sagas; _instance = instance; }
public ISagaInstance <CustomRoutesSoftwareProgrammingSaga, SoftwareProgrammingSagaData> Create(SleptWellEvent message) { var saga = new CustomRoutesSoftwareProgrammingSaga(); var data = new SagaDataAggregate <SoftwareProgrammingSagaData>(message.SofaId, new SoftwareProgrammingSagaData(saga.Sleeping.Name)); return(SagaInstance.New(saga, data)); }
public ISagaInstance <CustomRoutesSoftwareProgrammingSaga, SoftwareProgrammingSagaData> Create(GotTiredEvent message) { var saga = new CustomRoutesSoftwareProgrammingSaga(); var data = new SagaDataAggregate <SoftwareProgrammingSagaData>(message.PersonId, new SoftwareProgrammingSagaData(saga.Coding.Name)); return(SagaInstance.New(saga, data)); }
public Given_AutomatonymousSaga(Func <SoftwareProgrammingSaga, State> initialState) { var sagaData = new SoftwareProgrammingSagaData(initialState(SagaMachine).Name); SagaDataAggregate = new SagaDataAggregate <SoftwareProgrammingSagaData>(Guid.NewGuid(), sagaData); SagaInstance = new SagaInstance <SoftwareProgrammingSaga, SoftwareProgrammingSagaData>(SagaMachine, SagaDataAggregate); }
public void Given_saga_when_publishing_known_message_without_saga_data(bool sagaHasId, bool sagaHasData) { var softwareProgrammingSaga = new SoftwareProgrammingSaga(); var coffeMadeEvent = new CoffeMadeEvent(Guid.NewGuid(), Guid.NewGuid()); var sagaDataAggregate = Aggregate.Empty <SagaDataAggregate <SoftwareProgrammingSagaData> >(!sagaHasId ? Guid.Empty : Guid.NewGuid()); sagaDataAggregate.RememberEvent(softwareProgrammingSaga.CoffeReady, !sagaHasData ? null : new SoftwareProgrammingSagaData(""), null); var saga = SagaInstance.New(softwareProgrammingSaga, sagaDataAggregate); saga.Transit(coffeMadeEvent); //No exception is raised }
public void Given_instance_saga_When_recovering_from_creation() { var aggregateFactory = new AggregateFactory(); var sagaId = Guid.NewGuid(); _data = aggregateFactory.Build <SagaDataAggregate <SoftwareProgrammingSagaData> >(sagaId); var saga = new SoftwareProgrammingSaga(); var initialState = new SoftwareProgrammingSagaData(saga.MakingCoffee.Name); var eventsToReplay = new DomainEvent[] { new SagaCreatedEvent <SoftwareProgrammingSagaData>(initialState, sagaId) }; _data.ApplyEvents(eventsToReplay); _sagaInstance = SagaInstance.New(saga, _data); //Try to transit saga by message, available only in desired state _coffeMakeFailedEvent = new CoffeMakeFailedEvent(Guid.NewGuid(), Guid.NewGuid()); _sagaInstance.Transit(_coffeMakeFailedEvent); _dispatchedCommands = _sagaInstance.CommandsToDispatch; }
public ISagaInstance <SoftwareProgrammingSaga, SoftwareProgrammingSagaData> Create(SagaDataAggregate <SoftwareProgrammingSagaData> message) { return(SagaInstance.New(new SoftwareProgrammingSaga(), message)); }
public int GetHashCode(SagaInstance <T> message) { return(message.Saga.CorrelationId.GetHashCode()); }
public bool Equals(SagaInstance <T> x, SagaInstance <T> y) { return(Equals(x.Saga.CorrelationId, y.Saga.CorrelationId)); }
public InMemorySagaConsumeContext(ConsumeContext <TMessage> context, SagaInstance <TSaga> instance) : base(context) { _instance = instance; }
public InMemorySagaConsumeContext(ConsumeContext <TMessage> context, SagaInstance <TSaga> saga) : base(context, saga.Instance) { _saga = saga; }