public static void EnumerateDataEvents <T>(this T saga, Action <SagaEvent <T>, IEnumerable <State> > messageAction) where T : SagaStateMachine <T>, ISaga { var inspector = new SagaStateMachineEventInspector <T>(); saga.Inspect(inspector); inspector.GetResults().Each(x => { messageAction(x.SagaEvent, x.States); }); }
protected virtual void EstablishContext() { var saga = new TestSaga(Guid.NewGuid()); var inspector = new SagaStateMachineEventInspector<TestSaga>(); saga.Inspect(inspector); Results = inspector.GetResults().ToArray(); }
protected virtual void EstablishContext() { var saga = new TestSaga(Guid.NewGuid()); var inspector = new SagaStateMachineEventInspector <TestSaga>(); saga.Inspect(inspector); Results = inspector.GetResults().ToArray(); }
public IEnumerator <SagaDistributorConnector> GetEnumerator() { TSaga instance = FastActivator <TSaga> .Create(Guid.Empty); var inspector = new SagaStateMachineEventInspector <TSaga>(); instance.Inspect(inspector); return(inspector.GetResults() .Select(x => CreateConnector(x.SagaEvent.MessageType, x.SagaEvent.Event, x.States)) .SelectMany(x => x.Create()) .GetEnumerator()); }
public IEnumerator <SagaSubscriptionConnector> GetEnumerator() { T instance = FastActivator <T> .Create(Guid.Empty); var inspector = new SagaStateMachineEventInspector <T>(); instance.Inspect(inspector); return(inspector.GetResults() .Select( x => { return (SagaEventConnectorFactory)FastActivator.Create(typeof(SagaEventConnectorFactory <,>), new[] { typeof(T), x.SagaEvent.MessageType }, new object[] { _sagaRepository, _policyFactory, x.SagaEvent.Event, x.States }); }) .SelectMany(x => x.Create()) .GetEnumerator()); }
private IEnumerable <UnsubscribeAction> ConnectSinks <TComponent, TSaga>(ISubscriberContext context, TComponent instance) where TComponent : ISagaWorker <TSaga> where TSaga : SagaStateMachine <TSaga>, ISaga { var saga = FastActivator <TSaga> .Create(CombGuid.Generate()); var inspector = new SagaStateMachineEventInspector <TSaga>(); saga.Inspect(inspector); foreach (var result in inspector.GetResults()) { Type distributedType = typeof(Distributed <>).MakeGenericType(result.SagaEvent.MessageType); if (!context.HasMessageTypeBeenDefined(distributedType)) { context.MessageTypeWasDefined(distributedType); yield return(ConnectSink(context, instance, result.SagaEvent.MessageType, result.SagaEvent.Event, result.States)); } } }