Quantcast
Channel: Spring Community Forums - JMS
Viewing all articles
Browse latest Browse all 51

jmsTemplate + add listener to listener container

$
0
0
I'm newbie with Apache ActiveMQ and
I've started using 5.8.0 release + Spring


I want that every session created in a servlet container ( Tomcat ), subscribes itself as consumer/listener for message from a Topic ( created into JMS broker by an admin )

I've got some questions:

If I've got a listener container as

<jms:listener-container concurrency="10" >
<jms:listener id="QueueListener" destination="Queue.Name" ref="queueListener" />
</jms:listener-container>
</beans>

1)

Can I add <jms:listener> ( a.k.a MessageListener ) to Listener Container on runtime ?
I want to add one listener per web session
How ?

2)

If I can't,

Can I create a Consumer on runtime and set a MessageListener for it by using jmsTemplate?
I tried to do it with JMS API in jmsTemplate.execute() with SessionCallback,
And a Consumer is created but MessageListener never is called and message is never consumed from Topic.

Why ? How ?


3)

If I can't ,

If I use PooledConnectionFactory + JMS API ( no listener-container )
do I need to close Connection objects and release Consumers/Producers by hand ?

Remember I want to create a Consumer per session


4)

Is there other way to do all these things on an easy mode ?

Thanks and regards

Viewing all articles
Browse latest Browse all 51

Trending Articles