my dog learned polymorphism*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
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.
 
GeeCON Prague 2014
 
subject: Timeout for JMS Receiver.