You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jim Newsham <jn...@referentia.com> on 2010/10/12 00:13:45 UTC

how to use jms temporary queue (without jmsreplyto)

The documentation on jms temporary destinations is very sparse.  I'm 
struggling to understand how I can use a jms temporary queue with Camel, 
outside the use case of request/reply, which Camel already handles 
automatically.

I want to create a route which receives messages on a temporary jms 
queue.  Then I want to send the name of that queue to someone else, for 
later use in sending me messages.  I can't use JMSReplyTo, because I'm 
not requesting an immediate response (it's not request/reply).

The documentation at http://camel.apache.org/jms.html says to just use 
an url of the form "jms:temp:queue:foo".  Ok, easy.  But as I understand 
it, foo is not the actual name of the queue, since you can't request a 
named temporary queue in jms.  So the actual queue that gets created 
will have a different name.  So, (I think) I need to find that actual 
queue name so that I can transmit it to someone else.  How do I do 
that?  And when is the queue created so that I know when the name is 
available?  After CamelContext.start()?

Thanks,
Jim



Re: how to use jms temporary queue (without jmsreplyto)

Posted by Christian Schneider <ch...@die-schneider.net>.
  Hi Jim,

I am not sure if it is possible to simply send a temp queue name around. 
The jms server somehow manages who may access a temp queue. I guess when 
you set replyto on a message to the temp queue this will allow the 
receiver of the message to respond on this queue. If you simply send the 
queue name in another way I guess the other client will get an exception 
when he accesses the queue.

Perhaps you can simply use replyto on the message that tells the server 
that you want to receive events on this temp queue. The server can then 
extract the jmsreplyto and use it to send several events later. To send 
to the temp queue you can set the header CamelJmsDestination on a camel 
message to override the default destination of an endpoint.

In any case you will have to handle the case when you somehow loose the 
connection to jms server as the temp queue gets destroyed then. 
Additionally you have to make sure the temp queue does not get destroyed 
because there is no listener and I am not sure how you could define the 
listener for the temp queue.

So all in all it will be quite difficult to achive your desired 
behaviour with a temp queue. Perhaps someone has another idea for your 
problem.

Best regards

Christian


Am 12.10.2010 03:03, schrieb Jim Newsham:
>
> We wanted a queue scoped to the lifetime of the connection, and scoped 
> to a single jms client, so temporary jms queues are a pretty good 
> fit.  When the connection dies, the queue and its contents can be 
> automatically discarded.  No ACL needed for the queue.  etc.  It's 
> essentially a one-way event stream, there are no transactional 
> concerns.  Also, the producer will notice when the client disconnects 
> (the temporary queue dies), and can stop sending.
>
> Jim
>
> On 10/11/2010 2:53 PM, Ashwin Karpe wrote:
>> Hi,
>>
>> I am not sure what you are trying to do, but why not have a named 
>> queue and
>> a Correlation Id to map requests to responses. This way you do not 
>> have to
>> worry about time taken by the overall transaction to complete.
>>
>> Passing around temporary queue names around is highly unusual since by
>> definition, temporary queues do not survive if there are no producers or
>> consumers are around and the queue is empty. Also if the broker goes 
>> down,
>> such queues are not re-created.
>>
>> Cheers,
>>
>> Ashwin...
>>
>> -----
>> ---------------------------------------------------------
>> Ashwin Karpe
>> Apache Camel Committer&  Sr Principal Consultant
>> FUSESource (a Progress Software Corporation subsidiary)
>> http://fusesource.com http://fusesource.com
>>
>> Blog: http://opensourceknowledge.blogspot.com
>> http://opensourceknowledge.blogspot.com
>> ---------------------------------------------------------
>
>

-- 
----
http://www.liquid-reality.de


Re: how to use jms temporary queue (without jmsreplyto)

Posted by Jim Newsham <jn...@referentia.com>.
We wanted a queue scoped to the lifetime of the connection, and scoped 
to a single jms client, so temporary jms queues are a pretty good fit.  
When the connection dies, the queue and its contents can be 
automatically discarded.  No ACL needed for the queue.  etc.  It's 
essentially a one-way event stream, there are no transactional 
concerns.  Also, the producer will notice when the client disconnects 
(the temporary queue dies), and can stop sending.

Jim

On 10/11/2010 2:53 PM, Ashwin Karpe wrote:
> Hi,
>
> I am not sure what you are trying to do, but why not have a named queue and
> a Correlation Id to map requests to responses. This way you do not have to
> worry about time taken by the overall transaction to complete.
>
> Passing around temporary queue names around is highly unusual since by
> definition, temporary queues do not survive if there are no producers or
> consumers are around and the queue is empty. Also if the broker goes down,
> such queues are not re-created.
>
> Cheers,
>
> Ashwin...
>
> -----
> ---------------------------------------------------------
> Ashwin Karpe
> Apache Camel Committer&  Sr Principal Consultant
> FUSESource (a Progress Software Corporation subsidiary)
> http://fusesource.com http://fusesource.com
>
> Blog: http://opensourceknowledge.blogspot.com
> http://opensourceknowledge.blogspot.com
> ---------------------------------------------------------


Re: how to use jms temporary queue (without jmsreplyto)

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,

I am not sure what you are trying to do, but why not have a named queue and
a Correlation Id to map requests to responses. This way you do not have to
worry about time taken by the overall transaction to complete.

Passing around temporary queue names around is highly unusual since by
definition, temporary queues do not survive if there are no producers or
consumers are around and the queue is empty. Also if the broker goes down,
such queues are not re-created.

Cheers,

Ashwin...   

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com
http://opensourceknowledge.blogspot.com 
---------------------------------------------------------
-- 
View this message in context: http://camel.465427.n5.nabble.com/how-to-use-jms-temporary-queue-without-jmsreplyto-tp3208170p3208266.html
Sent from the Camel - Users mailing list archive at Nabble.com.