Tuesday, September 13, 2011

Oracle Service Bus (OSB) and JCA Adapters

We were recently working on a project that had the need to create a custom JCA adapter to connect from the OSB to a legacy C application.  We figured this would be something fairly easy to do since the WebLogic Server, BPEL and OSB all support JCA adapter out of the box.  It turns out that the current OSB (11g) doesn't fully support the JCA adapter specification.  It only supports the following JCA compliant adapters provided by Oracle:
  • Oracle Adapter for Oracle Applications
  • Oracle JCA Adapter for AQ
  • Oracle JCA Adapter for Database
  • Oracle JCA Adapter for Files
  • Oracle JCA Adapter for FTP
  • Oracle BAM Adapter
  • PeopleSoft Adapter
  • SAP R/3 Adapter
  • Siebel
  • J.D. Edwards
The OSB already has transports that support File/FTP so these really are not needed.  We actually tried using these on the bus and didn't have much success so quickly reverted back to the built in OSB functionality.

Anyway, we were looking for a way to utilize the custom JCA adapter on the bus and came across the OSB Transport API. It appeared that this would do the trick but seemed extremely complicated so we kept digging. We eventually settled on deploying the JCA adapter to the WebLogic Server and writing a small wrapper class that made it easy to access the adapter with a JNDI lookup. 

We were then able to simply use a Java Callout from the OSB to access the adapter.  This is obviously not the most elegant solution but has proved to work extremely well.  We were a little concerned about performance so we did a little testing.  We were able to push a single WLS managed server to over 3,000 adapter calls/second which is more then sufficient for our application. 

A few details:

  • The JCA wrapper class takes and returns an XML document as a string
  • It then uses JAXB to marshall/unmarshall it and calls the adapter
  • The marshaller has been optimized to not destory itself every time to prevent marshalling bottlenecks
  • The JCA wrapper also caches the JCA connection information