activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Wilkins <>
Subject Non static WebClient?
Date Fri, 24 Mar 2006 22:04:35 GMT

I was trying to tidy up the Ajax code so that consumers closed when
sessions timeout (or long polls stop coming).   But the queueConsumer
map in WebClient is static and key only by destination, which means:

 + You can only have one consumer per queue.    I can imagine Ajax
   apps that want to hand out messages to one of many clients and thus
   having multiple consumers would be a good way to do this.

 + As it stands, you don't know when the consumer is no longer needed.
   So it will live forever even if all sessions timeout.

I've reworked the code so that queue consumers are associated with
the httpSession (just as topic consumers) and they use the common 
jms session. unsubscribe now closes consumers as will long poll 
timeout and ending the session.

But I don't want to check it in, as I don't understand why the
consumers were static in the first place.  Some effort was put
into the static code and recovering the map from context 
attributes etc.  So I'd like to double check that I'm not
missing something?

I've attached a patch and would appreciate any comments.


View raw message