I have a Session bean (transaction managed by Container, Requries new) that uses JMS/MQ to get certain information from an IMS enviornment in a *synchronous* manner.So the bean writes certain queries to IMS on a queue and waits on reply queue.
Sometimes it so happens that IMS does not respond quickly - for whatever reasons. In such cases the transaction times out and container(websphere) rollsback entire transaction. Is there a way to do something like this:
Send message for IMS
see if it had taken more than 30 seconds - if so, throw an application exception? with in the boundaries of J2ee specification?
Thanks in advance
Specify a timeout on the blocking receive call. Example
Message m = QueueReceiver.receive(30000);
if(m == null) // we timed out and rollback the tran
Also be sure to have committed the tx where you send the original message, otherwise, it'll never get there :) You need two transactions, one to send and a new one to receive.
Thanks a lot!