public class TestSaga : SagaStateMachineInstance, IVersionedSaga
{
private readonly ITestService testService;
public TestSaga(
ITestService testService,
Guid correlationId)
{
this.testService = testService;
CorrelationId = correlationId;
}
public async Task DoSomething()
{
await testService.DoSomethingElse();
}
public Guid CorrelationId { get; set; }
public string CurrentState { get; set; }
public int Version { get; set; }
public long SomeId { get; set; }
}
public class TestSagaStateMachine :
MassTransitStateMachine<TestSaga>
{
public TestSagaStateMachine()
{
InstanceState(x => x.CurrentState);
Event(() => SomethingHappened , x => x.CorrelateBy(((saga, context) => saga.SomeId == context.Message.SomeId)).SelectId(context => NewId.NextGuid()));
Initially(
When(SomethingHappened )
.Then(context => context.Instance.SomeId = context.Data.SomeId )
.ThenAsync(async context =>
{
await context.Instance.DoSomething();
})
.TransitionTo(Active)
.Publish(context => (ISomethingElseHappenedEvent)new SomethingElseHappenedEvent(context.Data.SomeId))
);
//more code here
SetCompletedWhenFinalized();
}
public State Active { get; private set; }
public Event<ISomethingHappenedEvent> SomethingHappened { get; private set; }
}--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/d906887a-5c41-48e5-a71b-d9812ddb8809%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
public class MySagaStateMachine : MassTransitStateMachine<MySagaInstance>
{
private readonly Func<IMyShortLivingDependency> _shortLivingDependencyFactory;
public MySagaStateMachine(Func<IMyShortLivingDependency> shortLivingDependencyFactory)
{
_shortLivingDependencyFactory = shortLivingDependencyFactory;
....
During(Whatever,
When(Something).
Then(c => shortLivingDependencyFactory().HereWeGo(c.Data))
....
}
}--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/26bdd35e-e8db-47e8-9e66-9664c788cde1%40googlegroups.com.
Hey Chris,Is it possible to keep using the MongoDbSagaRepository and just use a specific implementation of IStateMachineActivityFactory? I'd like to still use the MongoDb as the persistence layer, however, it seems that I'd have to rewrite the MongoDbSagaRepository with the additional support for the SimpleInjector. Is that right? Or am I missing something (probably I am).
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/ce2e641b-6da7-4cc5-a297-f509253aad27%40googlegroups.com.