Announcement Announcement Module
No announcement yet.
JmsGateway: Injecting an ErrorListener into the DefaultMessageListenerContainer Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • JmsGateway: Injecting an ErrorListener into the DefaultMessageListenerContainer


    Quick question:

    I have a jms-gateway configuration for which I need to configure the underlying DefaultMessageListenerContainer. I need to do some custom error processing if the DefaultMessageListenerContainer is unable to connect to the its underlying queue.

    In other words, I need to inject a javax.jms.ExceptionListener into the DefaultMessageListenerContainer used by my JmsGateway pojo. Is there any way do inject such an ErrorListener through Spring Integration / Spring short of exposing a DefaultMessageListenerContainer bean and injecting that whole bean into the jms-gateway configuration ?


  • #2
    Currently, the only way would be to configure the DefaultMessageListenerContainer bean and then provide that as a bean reference for the JmsGateway.

    In theory, we could duplicate all of the configuration options of the message-listener container bean, but it doesn't seem right to do so. In fact, I am having second thoughts about doing as much as we are. It might be a lot simpler if we just expose a JMS MessageListener implementation (actually a Spring SessionAwareMessageListener) - including namespace support for that. Then, one could always use the core Spring "jms" namespace to do the following:
    <jms:listener-container ... >
        <jms:listener ref="jmsInboundGateway" ... />
    <si-jms:inbound-gateway id="jmsInboundGateway" ... />
    If the listener container configuration evolves, we would not be duplicating the effort, and besides, this would make it easier for someone to use other listener-container types.

    Based on your current situation, would you actually agree that approach might be simpler?