Pub-Sub error handling strategy

帅比萌擦擦* 提交于 2020-01-07 02:30:48

问题


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.

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?


回答1:


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.

  1. Error handling is the subscribers responsibility

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



来源:https://stackoverflow.com/questions/6732283/pub-sub-error-handling-strategy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!