I am hoping someone can help me out with this :). Thanks in advance!
The scenario is like this. Client call EJB method. Inside the method one of the task is to make a connection to a external server to process and get some data.
As the external server processing might take very long to complete, I need to be able to timeout the client. And if the external server reply after the timeout, I need to inform it to rollback the processing.
I am thinking of doing it with a JMS request/response. Client call EJB, EJB send a JMS message to Queue (Q1), with TemporaryQueue (TQ2) as the reply channel. EJB then receives on TQ2 with a timeout setting. MDB picks up the message in Q1 and goes off to do it processing and at a later point in time send the result back using TQ2.
The problem here is since the EJB is the one controlling the timeout. How does EJB inform MDB that it has already timeout so that MDB can do the necessary rollback processing ?
I was thinking of deleting TQ2 immediately after the receive returns so that MDB will have a exception when it tries to write to TQ2.
However, this might result in 1) EJB timeout, 2) MDB send to TQ2, 3) EJB delete TQ2 without knowing there is a message. 4) MDB doesn't know that EJB has timeout.
Anyone can give me some suggestions ?
p.s. Sorry for such a long posting :P