I'm investigating Spring Integration because I need some lightweight (asynch of course) event dispatching mechanism to multiple subscribers, that would be transactional, both on publish and subscribe side.
Meaning, when publisher puts event message on pub-sub channel, I don't want it to be received by subscribers until publish invoking transaction has been committed.
Also on subscriber side - I don't want event message to be removed from channel (for each subscriber), until the subscriber has not consumed the event in successful transaction.
Is this possible to implement in Spring Integration?
Until now, I have checked if transactional publishing works, but it seemed it does not with typical configuration like following:
After I published the event, I threw the exception causing the transaction on publishing side to rollback, but unfortunately, the subscriber still received the event :-(
<int:gateway id="myEventPublisher" service-interface="my.company.MyEventPublisher" default-request-channel="eventChannel"/>
<int:publish-subscribe-channel id="eventChannel" task-executor="eventDispatchingTaskExecutor"/>
<task:executor id="eventDispatchingTaskExecutor" pool-size="10"/>
<int:service-activator ref="myEventSubscriber" method="handleMyEvent" input-channel="eventChannel" />
<bean id="myEventSubscriber" class="my.comapany.MyEventSubscriber"/>
Any help with this, or Spring Integration is not capable of providing what is needed.