This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Timeout for JMS Receiver. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "Timeout for JMS Receiver." Watch "Timeout for JMS Receiver." New topic
Author

Timeout for JMS Receiver.

pankaj eklar
Greenhorn

Joined: Mar 27, 2008
Posts: 10
Hi,

I want to write code for following requirement:

1. I want to send a request message on one queue say Q1.
2. I should keep checking for response to the earlier request on another topic say T1, for next 2 mins.
3. If I dont receive a response on T1 within 2 mins I stop waiting for the response and continue.

There can be more than one instances which will put a message on Q1 and connect to T1 to wait for the response.

Now the real problem that I am facing is where do I write the code for counting two min timeout?

Any suggestions?

Thanks,
Pankaj
Sandip Sarkar
Ranch Hand

Joined: Nov 25, 2007
Posts: 55
Hi pankaj,


You can listen for the response from the topic T1 in the onMessage method. You can use a Timer by implementing the TimedObject interface and can wait for a timeout of 2 mins in the same method.

If i don't get a response that is to say my onMessage doesn't gets called in 2 mins...my timer expires and i don't need to wait.

Hope this helps.

Thanks,
Sandip
pankaj eklar
Greenhorn

Joined: Mar 27, 2008
Posts: 10
Hi Sandip,

Thanks for the quick reply. I noticed that TimedObject is not supported by Weblogic 8.1 sp5 (supported from weblogic 9.0 onwards). Please correct me if I am wrong about this. So I will not be able to use TimedObject.

If there is any other way to implement this?

Thanks,
Pankaj.
Sandip Sarkar
Ranch Hand

Joined: Nov 25, 2007
Posts: 55
Hi Pankaj,

The classes for EJB Timer Bean(TimedObject.class) are missing in their J2EE-Jar for Weblogic 8.1.

You can try by putting the TimedObject jar file in application classpath. But i am not sure if this works.

Thanks,
Sandip

pankaj eklar
Greenhorn

Joined: Mar 27, 2008
Posts: 10
Hi Sandip,

I am doing this change for one of the clients and I cant assume that they will have this jar file

Thanks,
Pankaj
pankaj eklar
Greenhorn

Joined: Mar 27, 2008
Posts: 10
Any inputs?

Thanks,
Pankaj
pankaj eklar
Greenhorn

Joined: Mar 27, 2008
Posts: 10
I have implemented this Using NotificationListener interface. But there is one more problem that I am facing. I will post it in a different thread. Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Timeout for JMS Receiver.
 
Similar Threads
How to implement HTTP connection time out
MQ messages stuck forever
Display message after session timeout in struts2
Session Time out
Bad DNS, can't update Emacs+