Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-3957

Prevent a feedback loop when connecting more spring application event bus

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Works as Designed
    • Affects Version/s: 4.2.4
    • Fix Version/s: None
    • Component/s: Event Support

      Description

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

      Example:
      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.

        Attachments

          Activity

            People

            Assignee:
            abilan Artem Bilan
            Reporter:
            malkusch Markus Malkusch
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: