How/when are sagas disposed?

120 views
Skip to first unread message

Andrei Alecu

unread,
May 9, 2012, 7:34:13 AM5/9/12
to masstransit-discuss
Greetings,

Been having some success lately with MassTransit and we're almost
ready to deploy it in production for a small app of ours.

There's one thing I'm concerned about. How does a Saga get disposed of
after it is complete? I don't see what marks a Saga to be complete,
there could always be a message coming later on, so does this mean
that MassTransit keeps it in memory indefinitely?

Here's some simple code:

https://gist.github.com/8a65b2a3306fb2e02634

When/how are instances of ActionSaga disposed of?

Thanks,
Andrei

Chris Patterson

unread,
May 9, 2012, 9:35:35 AM5/9/12
to masstrans...@googlegroups.com
Well, in this case you are using the in memory saga repository. And your saga is managing its own state (vs using our state machine saga language). So removal of completed sagas really depends on whatever process you create to sweep and clear the repository of old sagas.

If you use the state machine language, you can define the states and transitions, and also specify a RemoveWhen expression that determines if the saga should be removed from the repository.

We rarely do this in production systems, however, and allow the sagas to remain in a Completed state (which is part of the state machine definition) so that they are available for audits.

Through mindful use of table partitioning this can be quite effective and highly performant.

____
Chris Patterson
> --
> You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
> To post to this group, send email to masstrans...@googlegroups.com.
> To unsubscribe from this group, send email to masstransit-dis...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/masstransit-discuss?hl=en.
>

Maor Hayoun

unread,
May 16, 2013, 3:19:09 AM5/16/13
to masstrans...@googlegroups.com
I've asked myself the same question - and your reply didn't answer about its usage of sagas (without the statemachine syntax).
in his code, there is no obvious "completed" state to indicate that saga can be disposed.
so in that case, how can you indicate that your in-memory saga is done?

Thanks
> To unsubscribe from this group, send email to masstransit-discuss+unsub...@googlegroups.com.

Chris Patterson

unread,
May 16, 2013, 1:36:19 PM5/16/13
to masstrans...@googlegroups.com
There is a pull request pending that demonstrates one way to do this, I'm not sure I'll bring that into the main codebase but it does provide a good example of how to do it.


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.

Maor Hayoun

unread,
May 17, 2013, 4:11:04 AM5/17/13
to masstrans...@googlegroups.com
thanks, i'll check it, can you provide the pull request #?
> To unsubscribe from this group, send email to masstransit-discuss+unsubscribe...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/masstransit-discuss?hl=en.
>

--
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.
Reply all
Reply to author
Forward
0 new messages