Implementing synchronous request/response for an asynchronous service (JMS)
843830Jun 6 2006 — edited Jun 8 2006Hi,
I've to consume soap/jms service from an external application.
The requirement is to consume it synchronous, meaning, the thread should wait for response.
I.e :
void service(){
String id = generateCorrelationID();
Message msg = createRequest(id,...);
// send the message to the request queue
sendMesageToRequestQueue(msg);
Message responseMsg = null;
// search for the response, if is not found suspend the thread, then search again ...
do {
responseMsg = searchMessageInResponseQueue(id);
if(responseMsg == null) {
<Thread>.sleep(xxx)
}
} while (<messageIsNotFound>
}
my application is J2EE 1.3.
Is it reasonable? am I going to face with deadlocks? locking issues? ...
Thanks