Tracking the state of saga instances

594 views
Skip to first unread message

Tomer Yoskovich

unread,
Dec 21, 2015, 4:24:11 AM12/21/15
to masstransit-discuss
Hello,

I am thinking about two issues that maybe someone can help me understand better

some context: I have a UI web server that would like to show the current state of each saga instance.
The saga runs in a separate process, I call it the Process Manager. 
1) Where should the UI web server fetch data for view from? It could listen to events of "completed" for on going update, but assuming the web server UI server is ever stopped, where should it receive its initial state?
I was thinking about exposing web api from the Process Manager (the saga)'s process. But I'm not sure exactly how do fetch data for all saga instances. Does this idea seem reasonable? how would I go about doing it?

2) I would also like to know about shutting down the process manager; I'm assuming that the await bus.stop() stops receiving any more messages from RabbitMQ, finishes handling the currently executing ones, and then returns. Is that correct?

Thanks

Chris Patterson

unread,
Dec 21, 2015, 9:23:47 AM12/21/15
to masstrans...@googlegroups.com
Calling Stop (or StopAsync) shuts down gracefully yes. 

If you're using the in memory saga repository, you realize it too will lose all state of the process restarts don't you? 

__
Chris Patterson




--
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/980215f4-b5b0-48a0-b3c4-f656a5602ac4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tomer Yoskovich

unread,
Dec 21, 2015, 9:53:35 AM12/21/15
to masstransit-discuss
I am using the EntityFramework repository (using as a reference your example project code)


On Monday, December 21, 2015 at 4:23:47 PM UTC+2, Chris Patterson wrote:
Calling Stop (or StopAsync) shuts down gracefully yes. 

If you're using the in memory saga repository, you realize it too will lose all state of the process restarts don't you? 

__
Chris Patterson




On Mon, Dec 21, 2015 at 1:24 AM -0800, "Tomer Yoskovich" <to...@yoskovich.com> wrote:

Hello,

I am thinking about two issues that maybe someone can help me understand better

some context: I have a UI web server that would like to show the current state of each saga instance.
The saga runs in a separate process, I call it the Process Manager. 
1) Where should the UI web server fetch data for view from? It could listen to events of "completed" for on going update, but assuming the web server UI server is ever stopped, where should it receive its initial state?
I was thinking about exposing web api from the Process Manager (the saga)'s process. But I'm not sure exactly how do fetch data for all saga instances. Does this idea seem reasonable? how would I go about doing it?

2) I would also like to know about shutting down the process manager; I'm assuming that the await bus.stop() stops receiving any more messages from RabbitMQ, finishes handling the currently executing ones, and then returns. Is that correct?

Thanks

--
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.

Chris Patterson

unread,
Dec 21, 2015, 10:30:50 AM12/21/15
to masstrans...@googlegroups.com
Oh, well, in that case, you could just query the persistent store for the state (if you can access it by some key) or use events published by the saga to update a separate "current view" state of the saga instances. That way you don't block the sagas by doing range queries against the same table. Depending upon your traffic volume, it may be okay to just query over the saga table using a snapshot isolation mode as well. Just be sure to watch for blocking due to lock contention.


On Mon, Dec 21, 2015 at 6:53 AM, Tomer Yoskovich <to...@yoskovich.com> wrote:
I am using the EntityFramework repository (using as a reference your example project code)

On Monday, December 21, 2015 at 4:23:47 PM UTC+2, Chris Patterson wrote:
Calling Stop (or StopAsync) shuts down gracefully yes. 

If you're using the in memory saga repository, you realize it too will lose all state of the process restarts don't you? 

__
Chris Patterson




On Mon, Dec 21, 2015 at 1:24 AM -0800, "Tomer Yoskovich" <to...@yoskovich.com> wrote:

Hello,

I am thinking about two issues that maybe someone can help me understand better

some context: I have a UI web server that would like to show the current state of each saga instance.
The saga runs in a separate process, I call it the Process Manager. 
1) Where should the UI web server fetch data for view from? It could listen to events of "completed" for on going update, but assuming the web server UI server is ever stopped, where should it receive its initial state?
I was thinking about exposing web api from the Process Manager (the saga)'s process. But I'm not sure exactly how do fetch data for all saga instances. Does this idea seem reasonable? how would I go about doing it?

2) I would also like to know about shutting down the process manager; I'm assuming that the await bus.stop() stops receiving any more messages from RabbitMQ, finishes handling the currently executing ones, and then returns. Is that correct?

Thanks

--
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.

--
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.

Tomer Yoskovich

unread,
Dec 21, 2015, 1:04:20 PM12/21/15
to masstransit-discuss
Thanks Chris,

I guess with this method I won't be able to use SetCompletedWhenFinalized()?



On Monday, December 21, 2015 at 5:30:50 PM UTC+2, Chris Patterson wrote:
Oh, well, in that case, you could just query the persistent store for the state (if you can access it by some key) or use events published by the saga to update a separate "current view" state of the saga instances. That way you don't block the sagas by doing range queries against the same table. Depending upon your traffic volume, it may be okay to just query over the saga table using a snapshot isolation mode as well. Just be sure to watch for blocking due to lock contention.

On Mon, Dec 21, 2015 at 6:53 AM, Tomer Yoskovich <to...@yoskovich.com> wrote:
I am using the EntityFramework repository (using as a reference your example project code)

On Monday, December 21, 2015 at 4:23:47 PM UTC+2, Chris Patterson wrote:
Calling Stop (or StopAsync) shuts down gracefully yes. 

If you're using the in memory saga repository, you realize it too will lose all state of the process restarts don't you? 

__
Chris Patterson




On Mon, Dec 21, 2015 at 1:24 AM -0800, "Tomer Yoskovich" <to...@yoskovich.com> wrote:

Hello,

I am thinking about two issues that maybe someone can help me understand better

some context: I have a UI web server that would like to show the current state of each saga instance.
The saga runs in a separate process, I call it the Process Manager. 
1) Where should the UI web server fetch data for view from? It could listen to events of "completed" for on going update, but assuming the web server UI server is ever stopped, where should it receive its initial state?
I was thinking about exposing web api from the Process Manager (the saga)'s process. But I'm not sure exactly how do fetch data for all saga instances. Does this idea seem reasonable? how would I go about doing it?

2) I would also like to know about shutting down the process manager; I'm assuming that the await bus.stop() stops receiving any more messages from RabbitMQ, finishes handling the currently executing ones, and then returns. Is that correct?

Thanks

--
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.

--
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.

Chris Patterson

unread,
Dec 21, 2015, 1:13:33 PM12/21/15
to masstrans...@googlegroups.com
Well, you could, but the history would be automatically deleted from the state table.

If you want the history, producing events to the view store might make more sense. And you can set the event table to partition by date so you can roll off partitions as they get older than you want to keep online.


On Mon, Dec 21, 2015 at 10:04 AM, Tomer Yoskovich <to...@yoskovich.com> wrote:
Thanks Chris,

I guess with this method I won't be able to use SetCompletedWhenFinalized()?


On Monday, December 21, 2015 at 5:30:50 PM UTC+2, Chris Patterson wrote:
Oh, well, in that case, you could just query the persistent store for the state (if you can access it by some key) or use events published by the saga to update a separate "current view" state of the saga instances. That way you don't block the sagas by doing range queries against the same table. Depending upon your traffic volume, it may be okay to just query over the saga table using a snapshot isolation mode as well. Just be sure to watch for blocking due to lock contention.

On Mon, Dec 21, 2015 at 6:53 AM, Tomer Yoskovich <to...@yoskovich.com> wrote:
I am using the EntityFramework repository (using as a reference your example project code)

On Monday, December 21, 2015 at 4:23:47 PM UTC+2, Chris Patterson wrote:
Calling Stop (or StopAsync) shuts down gracefully yes. 

If you're using the in memory saga repository, you realize it too will lose all state of the process restarts don't you? 

__
Chris Patterson




On Mon, Dec 21, 2015 at 1:24 AM -0800, "Tomer Yoskovich" <to...@yoskovich.com> wrote:

Hello,

I am thinking about two issues that maybe someone can help me understand better

some context: I have a UI web server that would like to show the current state of each saga instance.
The saga runs in a separate process, I call it the Process Manager. 
1) Where should the UI web server fetch data for view from? It could listen to events of "completed" for on going update, but assuming the web server UI server is ever stopped, where should it receive its initial state?
I was thinking about exposing web api from the Process Manager (the saga)'s process. But I'm not sure exactly how do fetch data for all saga instances. Does this idea seem reasonable? how would I go about doing it?

2) I would also like to know about shutting down the process manager; I'm assuming that the await bus.stop() stops receiving any more messages from RabbitMQ, finishes handling the currently executing ones, and then returns. Is that correct?

Thanks

--
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.

--
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.

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