Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question

handle exception in a polling container with FIFO grouping under tx

Hi, For a polling container with FIFO grouping under a transaction, if an exception occurs, the message will be rolled back into the space. Since polling container emulates the message queue semantics, the rolled back message (under a unrecoverable exception)will be polled back again and again by the polling container which will block all other messages in the space to be processed. Any suggestion how to handle exceptions for polling container with FIFO grouping under transaction? Thanks!

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=4061]{quote}

asked 2013-04-12 00:56:44 -0600

minshengshen gravatar image

updated 2013-08-08 09:52:00 -0600

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted


Managing a poison message in a transaction polling container is similar if FIFO group is used and if its not used.

you can read about it in this page : http://wiki.gigaspaces.com/wiki/display/XAP91/EventExceptionHandler ( at the last paragraph ). the basic idea is to keep a map of all the objects (Id) that throw exception with number of retries and if they repeat more then x amount of time, change their state so they will not get back to the polling container.

If you need more specific explanation let me know.


answered 2013-04-12 02:07:37 -0600

dragnot gravatar image
edit flag offensive delete link more


Hello, Thank you for your quick response! I should give a little more detail about our case: we have a polling container listens to a space (let's called Space1). Each message polled from Space1, after processed, can emit multiple messages which will be written into different spaces(let's call them downstreamSpace1 and downstreamSpace2, etc) for different components to process. Now the problem is, in your exception handler if you wrap your exception in a "poison exception" and handle it, how can you roll back the sub-messages already populated in downstreamSpace1 and downstreamSpace2?


minshengshen gravatar imageminshengshen ( 2013-04-12 08:12:09 -0600 )edit

Its not very complicated, as long as all operation are under transaction if there is an exception they will all rollback.

if the object continue to create exception you will change its state before making those changes, meaning the beginning of the space data event method and commit only that change. the object will not match the template anymore and will be moved to error handling in your code.

dragnot gravatar imagedragnot ( 2013-04-12 08:23:06 -0600 )edit

I am not sure if I follow. Let's say the event listener poll a message called Msg1 from Space1. After the Msg1 is processed, it emits 3 messages (subMsg1, subMsg2 and subMsg3). After subMsg1 and subMsg2 are written into downsteam spaces downstreamSpace1 and downstreamSpace2, and start to process subMsg3 and an exception occurs. At this time if you throw an exception, all operations including the take will roll back. No objects will be commited into downstreamSpace1 and downstreamSpace2. This rolled back message in Space1 is just like a new message and will be polled in repeatly. If you do not throw an exception and only change its state to processed and write it back to Space1, yes it is true it does not match your receiver template and will not be polled in again. But how are you going to roll back the subMsg1 and subMsg2 you already commited into the downstreamSpace1 and downstreamSpace2?

One solution I am thinking is we can use a different transaction manager for the downstram spaces. But I have not tested it yet.


minshengshen gravatar imageminshengshen ( 2013-04-12 09:21:30 -0600 )edit

If all operation you stated below happen in a single polling container, they should all rollback when Msg1 is entered back into the polling container you will know it already been there and not continue with the process but change it value and commit, this process will not happen again.

dragnot gravatar imagedragnot ( 2013-04-12 10:01:23 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-04-12 00:56:44 -0600

Seen: 276 times

Last updated: Apr 12 '13