Any Advantage using Message Sequences instead of a Saga?

18 views
Skip to first unread message

Brett Bailey

unread,
Apr 28, 2014, 6:30:56 AM4/28/14
to nginn-me...@googlegroups.com
I'm working on a document printing system where the user wants to print a batch of documents in a desired order.   The batch could be 20 docs it could be a few hundred.


My first option is to use message sequencing and queue up several hundred print doc messages in a sequence.  My concern here is that with a multi threaded handler can we really guarantee that the document will come out of the printer in the right order?  and what happens if one of the documents fails will the rest be stuck in limbo for ever or could they be pushed through somehow?

The other option is to use a saga.  The saga can take 1 big print batch message containing all the paths and then split this into individual print doc messages and publish them one at a time after receiving the response from the previous one.  This gives me options in terms of handling errors and timing out

The Saga seems to be the best option to but I'm wondering if there is a compelling reason to use the message sequencing instead?

Thanks

~Brett

Rafal Gwizdala

unread,
Apr 28, 2014, 6:54:56 AM4/28/14
to nginn-me...@googlegroups.com
Hi Brett,

I think the main advantage of the sequence mechanism is that it's already there, it's quite efficient, and you don't have to implement it using a saga. But it's a simple mechanism, it guarantees only that messages will be handled in order, but doesn't prevent a faulty message from stopping the whole sequence.  
So I agree saga is a better option for you - not only you can handle the splitting and joining of messages in any way you want, but you can also implement a safeguard mechanism that will handle stuck messages and make sure the whole batch completes even in case of single message failure. 

R


--
You received this message because you are subscribed to the Google Groups "nginn-messagebus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nginn-messageb...@googlegroups.com.
To post to this group, send email to nginn-me...@googlegroups.com.
Visit this group at http://groups.google.com/group/nginn-messagebus.

Reply all
Reply to author
Forward
0 new messages