During(Running)
.When(Updated)
.Then(context => MapToOutGoingMessage(context.Instance)) // save to initial.Then(MutateState)
.Then(context => MapToOutGoingMessage(context.Instance)) // save to final.If(context => context.??.initial != context.??.final,
binder => binder.Publish(context => context.??.final))
--
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/7d1b55e8-92f4-4f52-9d9a-7b09ab10a554%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
GetOrAddPayload() is the way to pass context/data between steps, so that's your best option. I'd make a class that has the behavior in it to compare the outgoing message instances and determine if it needs to be published. Then you can use it in the If statement....If(context => context.GetPayload<IOutgoingMessageBuilder>().IsUpdated, x => x.Publish(context => context.GetPayload<IOutgoingMessageBuilder>().OutgoingMessage));Or something to that nature.
On Thu, Jun 22, 2017 at 2:53 AM, Doug Paice <doug....@baralong.org> wrote:
I've got a use case where if certain values of a saga change then I need to publish a message (send a command to a handler to call an external system)The simplest (to me) option is:
- on the way in map the initial state to the out-going message type
- perform the update
- map to the final state to the out-going message type
- if they are different then publish the message
I was hoping do do something like:During(Running).When(Updated).Then(context => MapToOutGoingMessage(context.Instance)) // save to initial.Then(MutateState).Then(context => MapToOutGoingMessage(context.Instance)) // save to final.If(context => context.??.initial != context.??.final,binder => binder.Publish(context => context.??.final))But there seems to be no simple way of passing data between the steps, unless GetOrAddPayload is the wayThanks
--
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.