Reputation: 59
I am working on a POC using Spring Integration and STOMP. The initial POC is successful. I followed the adapters configuration mentioned in https://docs.spring.io/spring-integration/reference/html/stomp.html#stomp
In my POC, I did not include the last two @Bean definitions from the above link.
Inbound Channel Adapter and Message Handlers were sufficient to handle the incoming messages.
Now, my question is: What is the difference between Inbound channel adapters and application event listing message producers? Is ApplicationListener used when we follow DSL as mentioned in an example here?
Thanks,
Mahesh
Upvotes: 0
Views: 329
Reputation: 121262
Well, as you noticed in that Spring Integration documentation about STOMP support there is some bunch of ApplicationEvent
s emitted by STOMP Channel Adapters. You indeed can handle them using regular ApplicationListener
(@EventListener
) if your logic for handling those events is pretty much simple and doesn't need further distribution. But if your logic is much complicated and you may need store an even (or its part) in some database, or send via email, do that in parallel after some aggregtion, etc., then indeed that ApplicationEventListeningMessageProducer
is much better solution when we have Spring Integration on board already.
However if you talk about a StompInboundChannelAdapter
nature and relationship with those mentioned events, you need to take a look into the StompIntegrationEvent
implementations. You quickly realize that there is no events for payload
in the STOMP frame. So, that is what is done really by the StompInboundChannelAdapter
- it produces messages based on the body from STOMP frame.
All the mentioned events emitted fro that channel adapter are more about that adapter state sharing for possible management in your application.
Upvotes: 3