[jboss-user] [Messaging, JMS & JBossMQ] - Dynamic Listener creation?
Lajcik
do-not-reply at jboss.com
Thu Nov 22 05:53:15 EST 2007
Hello, im building a functionality where a person connects to the server, sends a request. the server then starts some business logic which produces jms messages for him. The user then connects to the sockect and receives that information through a stream from a message listener with a selector.
The socket part is implemented as fllows:
User ----[socket]----> Service Mbean ----[local]----> Stateless Session Bean ----[delegate]----> POJO -----[create]----> JMS Message Listener
My problem is - i cant find a satisfying way to dynamically create and destroy message listeners...
Tried creating message consumers with jmstemplate, but i get no messages :/
| jmsTemplate.execute(new SessionCallback() {
| public Object doInJms(Session session) throws JMSException {
| MessageConsumer mc = session.createConsumer(
| incomingQueue, "id='" + id + "'"
| );
| mc.setMessageListener(node);
| return null;
| }
|
I tried both - keeping the message consumer and suspending a thread on wait() inside the session callback - to no avail. Im running out of ideas and hits in google :)
I chose this approach because this way the jms queue can manage the message lifetime and distribution for me, i only register listeners with an appropriate selector... Is this a good approach or should i message driven pojo and manage incoming messages (their distribution and lifetime) manually? (which seems tedious and error-prone)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4107039#4107039
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4107039
More information about the jboss-user
mailing list