Are you struggling with a long running asynchronous Java web method that behaves like a synchronous process when being invoked by an asynchronous BPEL process? Then you may like to know how threading might help you to get rid of the timeout!
Use case
We“™ve set up a SOA composite application on Oracle SOA 11.1.1.6 having an asynchronous service implemented using BPEL (1.1/2.0). A Java web application offers a long running asynchronous web method using JAX-WS, which is invoked by the composite application. Both applications are deployed to the same SOA cluster where we have a timeout of 300s for synchronous BPEL processes (
SyncMaxWaitTime
):
If the long running Java web method takes longer than the defined value in the property
SyncMaxWaitTime
, the instance fails due to a timeout in the BPEL process. If you have a look on the instance via Enterprise Manager, you clearly see its state: faulted, but still running. The Invoke task of the BPEL process which calls the Java application is trapped in a pending state. But why does an asynchronous web method behave like a synchronous one and is blocking the caller?
The BPEL process expects an acknowledgement by the Java web method. Otherwise it is processed like a synchronous request. The Java application does not send an acknowledgement until its web method has finished. To get rid of this behavior, create a new thread in your Java application and put your long running tasks into that thread:
// pause process
try {
Thread.sleep(request_payload.getWaitTimeInMinutes() * 60 * 1000);
// send response
By starting a new thread, the Java web method now can finish and returns the acknowledgement to the invoking BPEL process. The Invoke task now is completed immediately and the process will go on to the Receive task to keep on waiting for the callback
-> Receive task now is pending instead of the Invoke task (compare Image 3 with Image 4).