During(Active, When(Submitted) .Then(context => { if (context.Data.Timestamp > context.Instance.Updated) context.Instance.Updated = context.Data.Timestamp; context.Instance.OrderId = context.Data.OrderId; }) .ThenAsync(context => Console.Out.WriteLineAsync($"Cart Submitted: {context.Data.UserName} to {context.Instance.CorrelationId}")) .Unschedule(CartExpired) .TransitionTo(Ordered),
--
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-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/6d9418d1-1b9a-4690-89a7-aae3f3a442d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Make sure your isolation level is serializable and this problem goes away. Two concurrent instances of the same saga won't execute.Use the InMemoryOutbox if you want to defer publishing of events until you're certain the state updates are persisted.__
Chris Patterson
--Hi, guys.As I understand, It's absolutely normal behavior for saga to rollback state saving operation (ISagaRepository<TSaga>.Send) and it happens many times during it's work. For example, when event comes in not appropriate state. So generally speaking we never can't be sure, that some TransitionTo execution will be successful. But nevertheless, in classic examples we execute TransitionTo method AFTER some logic, wrapped in Then, ThenAsync, Publish and so on (see the following code as example).During(Active, When(Submitted) .Then(context => { if (context.Data.Timestamp > context.Instance.Updated) context.Instance.Updated = context.Data.Timestamp; context.Instance.OrderId = context.Data.OrderId; }) .ThenAsync(context => Console.Out.WriteLineAsync($"Cart Submitted: {context.Data.UserName} to {context.Instance.CorrelationId}")) .Unschedule(CartExpired) .TransitionTo(Ordered),Why such examples recommend to save saga after logic if save transaction might be rollbacked?
Next, even if we move TransitionTo BEFORE logic, it will not help, because TransitionTo and Then are executed concurrently, and TransitionTo in slower in most cases. Is there any way to get TransitionTo success notification and only after it execute some logic?
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 unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsubscribe...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/6d9418d1-1b9a-4690-89a7-aae3f3a442d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/8753d433-48b8-428c-b260-48bef86db4db%40googlegroups.com.To post to this group, send email to masstransit-discuss@googlegroups.com.
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 masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/6d9418d1-1b9a-4690-89a7-aae3f3a442d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 masstrans...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsubscribe...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/6d9418d1-1b9a-4690-89a7-aae3f3a442d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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+unsubscribe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/8753d433-48b8-428c-b260-48bef86db4db%40googlegroups.com.
--
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/a64e673d-977e-4cea-9bd6-f1685b8259d5%40googlegroups.com.
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 masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/6d9418d1-1b9a-4690-89a7-aae3f3a442d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/8753d433-48b8-428c-b260-48bef86db4db%40googlegroups.com.
--
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 masstrans...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/d78430e3-5810-4db7-b975-208b0d649613%40googlegroups.com.