开发者

Pub-Sub error handling strategy

开发者 https://www.devze.com 2023-03-21 14:49 出处:网络
Here is my channels set-up: A jdbc message-store backed queue A bridge connecting the queue to a pub-sub channel

Here is my channels set-up:

  1. A jdbc message-store backed queue
  2. A bridge connecting the queue to a pub-sub channel
  3. The poller configured on the pub-sub channel is transactional

Now when there is an exception raised in any one of the subscribers then the transaction rolls back and the message is retried for ever. The message is again processed by all the subscribers again. If this is a permanent exception in at least subscriber then the message is not getting processed by none of the other subscribers.

What is the best exception handling strategy here?

I prefer exception handling on the subscriber i.e.only the failing subscriber will retry, other subscribers will process the message and move on.

开发者_StackOverflow

How can this be implemented in spring integration?

More details here..

  1. If the poller is made transactional and the message fails processing in at least one of the subscribers, then the message is rolled back to the message store and retried. I also configured a jdbc message store for the errorChannel. Every time the message processing fails, the message gets rolled back to the original message store and the error channel message store has one entry for each retry.

  2. If the poller is made non-transactional and the message fails processing in the first subscriber, then the message is put to the error channel, but the second subscriber never gets the message.

It appears that there is something fundamentally wrong.. Is it with my configuration?


http://forum.springsource.org/archive/index.php/t-75000.html
The discussion in the above thread explains the ups and downsides of the framework with respect to pubsub impl.

We chose to go with the below approach:

  1. Pollers will be transactional, meaning all subscribers process the message successfully or none of them. Message will be retried with all subs until all of them complete successfully.

  2. Error handling is the subscribers responsibility

  3. Only system exceptions will be bubbled back to the poller. Business exceptions will be handled by the subscriber and the message will be put to some error channel manually.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号