You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by um...@comcast.net on 2007/08/03 00:40:07 UTC

Synchronous "Are you there?" using JMS

I have two entities on either side of a queue. Entity A needs to do a 
synchronous "are you there?" on the queue and receive a response
synchronously from Entity B.

I thought I'd do this:
  - Define a Queue "Are you there" and dispatchAsync = false
  - create a session with CLIENT_ACK set
  - send "are you there" message to the queue

The receiver would acknowledge the message in the onMessage()
method. 

However, I would like for the sender to time out if the ack is not received 
within a specified time. I see no option to do this which is obvious.
How do I make sure that a synchronous send times out if the response
is not received within a specified interval?

Regards

/U



Re: Synchronous "Are you there?" using JMS

Posted by Mario Siegenthaler <ms...@inventsoft.ch>.
Just a thought, but why don't you use a topic for this? I think a
queue will cause problems because the message will be stored. So the
"I'm here" thing would possibly refer to an older question and would
no longer be relevant.
Hm, just reread your question, and realized that you directly want to
process the clients ack. I don't think that'll work. How'd you receive
the ack? Maybe a possiblity would be to define a max
queue/topic-buffer size of 1 and then the send would block until the
message is received. Another way would be to actually send a response
and the asker would just wait for a different message on a temporary
queue/topic. There's some utility in the JMS-API to do that.. sadly I
can never it's name.

Mario

On 8/3/07, uma_rk@comcast.net <um...@comcast.net> wrote:
>
> I have two entities on either side of a queue. Entity A needs to do a
> synchronous "are you there?" on the queue and receive a response
> synchronously from Entity B.
>
> I thought I'd do this:
>   - Define a Queue "Are you there" and dispatchAsync = false
>   - create a session with CLIENT_ACK set
>   - send "are you there" message to the queue
>
> The receiver would acknowledge the message in the onMessage()
> method.
>
> However, I would like for the sender to time out if the ack is not received
> within a specified time. I see no option to do this which is obvious.
> How do I make sure that a synchronous send times out if the response
> is not received within a specified interval?
>
> Regards
>
> /U
>
>
>

Re: Synchronous "Are you there?" using JMS

Posted by ttmdev <jo...@ttmsolutions.com>.
Have A create a temporary queue. A sends B the "are you there?" message, with
the "JMSReplyTo" message property set to the temporary queue.  After sending
the message on the main queue, A turns around and issues a receive on the
temporary queue, w/the appropriate timeout, to await the reply from B. You
may also want to have the message expire. 

In the meantime,  if B is there, it receives the message checks for
JMSReplyTo, then sends back, "yes, i am here" ackowledgment. If B is not
there, A's receive times out and the "are you there" message expires. 

Hope this helps,
Joe

 

uma_rk wrote:
> 
> 
> I have two entities on either side of a queue. Entity A needs to do a 
> synchronous "are you there?" on the queue and receive a response
> synchronously from Entity B.
> 
> I thought I'd do this:
>   - Define a Queue "Are you there" and dispatchAsync = false
>   - create a session with CLIENT_ACK set
>   - send "are you there" message to the queue
> 
> The receiver would acknowledge the message in the onMessage()
> method. 
> 
> However, I would like for the sender to time out if the ack is not
> received 
> within a specified time. I see no option to do this which is obvious.
> How do I make sure that a synchronous send times out if the response
> is not received within a specified interval?
> 
> Regards
> 
> /U
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Synchronous-%22Are-you-there-%22-using-JMS-tf4209545s2354.html#a11981707
Sent from the ActiveMQ - User mailing list archive at Nabble.com.