Spring-4.2 introduced @EventListener and support for arbitrary Event types. I'm using this infrastructure to send and handle some domain events in my application.
Now I have the need to broaden the scope of this event bus to a further VM. spring-integration-event comes very handy to push and pull those events to a channel (e.g. JMS).
Unfortunately a biderectional setup where two event buses are connected with each other would produce a feed back loop.
1. Application A emmits an event a1 with the ApplicationEventPublisher.
2. Application A's ApplicationEventListeningMessageProducer pushes a1 into the channel
3. Application B's ApplicationEventPublishingMessageHandler receives the event a1 and fires with the ApplicationEventPublisher.
4. Application B's ApplicationEventListeningMessageProducer receives a1 and publishes the into the channel
5. Application A's ApplicationEventPublishingMessageHandler receives the event and fires it again. Continue at 1.
As a quick solution I could restrict the event adapters to discrete types. But I think that it should be possible to prevent such a feedback loop directly within the infrastructure: ApplicationEventPublishingMessageHandler could maybe mark published events so that ApplicationEventListeningMessageProducer will not send them into the channel again.