Search code examples
javaspringspring-integrationspring-jmsoracle-aq

Multiple OracleAQ listeners in the same jms container in Spring?


Is it possible to create multiple listeners (for different topics) within once defined jms container in spring?

Assume following configuration...

<bean id="jmsContainer" class="{container class here}">
...
</bean>

and

<bean id="messageListener" class="org.springframework.jms.listener.adapter.MessageListenerAdapter">
...
</bean>

Is it possible to have more than one messageListener* in jmsContainer?

If it is... Is it good pattern to do so or it is better idea to use as many containers as many listeners you need?


Solution

  • No; you need a container for each listener. Even when using the namespace for convenience...

    <jms:listener-container ...>
       <jms:listener .../>
       <jms:listener .../>
    </jms:listener-container />
    

    ...you get a seperate container for each listener. The namespace is just a convenient way to set common attributes for each container.