Best Practices from Oracle Development's A‑Team

Oracle SOA 10G Tricks: Optimize calling path between ESB and BPEL


In SOA 10G, it is a good practice to have BPEL and ESB co-located at the same JVM. Doing so not only improves performance but also allows JTA global transaction propagation between the two. However, these advantages will not be fully materialized, or even will totally disappear, if wrong protocols were chosen when these two components call each other.

Main Article

1. BPEL calling ESB

When developers write BPEL processes that call ESB, many don't think about the protocols used in the calls. The fact of the matter is, if you don't pay attention you may end up making the call via SOAP, instead of a more efficient protocol, even if the ESB endpoint is running on the same JVM. The problems of having the call going through SOAP are

Problem 1: It breaks the JTA transaction. Often times you want a JTA global transaction to propagate from BPEL to ESB
Problem 2: It is less performant. The call may first have to go to the HTTP load balancer and then routed back, only to the same JVM from which the call is initiated.

Here is the syntax of making BPEL -> ESB invocation native:

Original partner binding at bpel.xml


Should be changed to:


You should get the actual value of __esb_{partnerlink}_{porttype} from the ESB's WSDL file http://xxx:7777/esb/wsil/AIASystem/EBS/SalesOrderOrchastrationEBS?wsdl

2. ESB calling BPEL

On the other hand, when you have ESB call BPEL at the same JVM, there are three possibilities for the calling protocols:
C. EJB local interface.

EJB local interface would typically deliver better performance than RMI (which involves JNDI look-up, serialization, etc), and RMI often time delivers better performance than SOAP. Both RMI and EJB local interface could allow the JTA transaction context to be propagated (as long as both ESB and BPEL are in the same OC4J), while SOAP will break the JTA transaction boundary as we mentioned earlier.

For best performance and also preserving the transaction context, you typically want to choose the EJB local interface. In the SOA 10g's term, it is call "local invocation".

To choose the right protocol, you start at the design time. You want to choose the BPEL endpoint from the auto generated "BPEL services" from the ESB designer. If you create an "external service" using the WSDL of BPEL, the designer will choose the communication protocol to be SOAP. To verify whether the BPEL endpoint is treated as a "BPELService" or "External Service", you can simply open the *.esbvc file for that BPEL endpoint. You should be able to find "BPELService" in the esbvc file.

Now, once the designer creates the BPEL endpoint as a BPELService, the default protocol would be RMI.

You can then further optimize this call by changing the protocol from RMI to local interface. The latter means ESB calls BPEL as if one EJB calls another EJB in the same JVM via local interface. The configuration for this optimization is a bit more tricky than optimizing the BPEL -> ESB route.

Step 1: Enable the global JNDI for the OC4J container by adding global-jndi-lookup-enabled="true" to the application-server element in server.xml.

Step 2: Add an endpoint property called InvocationMode to the Oracle ESB service that represents the BPEL process, and specify a value of local. Do this through the Properties tab on the ESB Service Definition page in Oracle ESB Control. Possible values for this property are local and remote. The default value is remote, which implies that by default Oracle ESB calls BPEL processes over RMI. RMI protocol still allows the JTA transactions can be propagated except it incurs more latency than 'local'. The "local" invocation mode only applies when ESB and BPEL are running within the same JVM.

Step 3: (to work around a known issue), to ensure that the routing service can call a BPEL process using InvocationMode=local, you must make sure that property is available by adding the InvocationMode property to the bpel.xml of the BPEL process being called, as shown in the following example.


Step 4. ESB to BPEL communication uses "oc4jinstancename" property defined in "ant-orabpel.properties" to determine the instance name of the current oc4j node. This is required for successful lookup of BPEL delivery service. In clustered environment this property takes a different meaning (it is used for group name) and cannot be used as "oc4jinstancename" so another property called "local.oc4jinstancename" should be defined to specify the local oc4j instance name, for the lookup to function correctly.

Step 5: Restart the server (required for step 1 above). Setting the global JNDI attribute to true flattens the JNDI tree.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha

Recent Content