activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Fernandez <>
Subject Re: (hopefully) simple JMS question
Date Thu, 07 Aug 2008 19:22:43 GMT

The 'temporary' destinations behave a little differently. A temporary
destination's lifetime is that of the connection that created it. I'd
recommend reusing session objects if you can. They, along with the Producer
and Consumer objects, are lightweight objects, but creating and destroying
them generates network traffic to and from the broker. 


bsnyder wrote:
> On Thu, Aug 7, 2008 at 12:41 PM, David Crisp <>
> wrote:
>> Hi,
>>     I have a quick question regarding the JMS spec and I was hoping to
>> solicit
>> feedback from our merry band of domain experts.
>>     Given that Sessions are not thread-safe, if I'm creating a little
>> client-side
>> API that gets hit by a myriad of threads and do not want to synchronize
>> the API points,  I need to create a new Session on the stack for each
>> thread context.   Destinations ARE thread safe, but are created via a
>> specific Session instance.   Given this, can I assume that destination
>> instances
>> remain valid even after the Session that created them is destroyed?  
>> I've
>> looked at
>> the JMS spec and it seems fairly silent on this point.
>> Thanks in advance,
>> D.
>> P.s.  I'm assuming this must be true given that Destination creation
>> can't
>> be cheap since it requires communication with the broker.
> Yes, once a destination has been created, it will exist on the broker
> even if the session that created it is destroyed. This is because the
> session is simply used to interact with the broker and send it
> commands.
> Bruce
> -- 
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
> Apache ActiveMQ -
> Apache Camel -
> Apache ServiceMix -
> Blog:

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message