Thursday, May 20, 2010

OSB and Java Callout, a fierce discussion

here is my take:

During a discussion, somebody said that we should use Java Callouts with great care, because
A) they introduce an extra artifact, a JAR file (or multiple JAR files) to maintain;

and

B) because there are performance issues tied to Java Callouts.

For point A, I can only say that Ant exists :o) , so there is no real need to generate and deploy JARs by hand. Here http://ant.apache.org/ is Ant :o) , your friend.

For point B, I am still looking for some documentation or actual POC proving that Java Callouts introduce a performance hit, and under which circumstances, and of which extent. So if you are aware of anything, please show us.

I am not saying we SHOULD use Java Callouts, but I am not ruling out the technology in specific cases where it really makes sense.


Anyway here is the documentation from Oracle
http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/userguide/pojo.html


I found this particularly interesting:

A single POJO can be invoked by one or more proxy services. All the threads in the proxy services invoke the same POJO. Therefore, the POJO must be thread safe. A class or method on a POJO can be synchronized, in which case it serializes access across all threads in all of the invoking proxy services. Any finer-grained concurrency (for example, to control access to a DB read results cache and implement stale cache entry handling) must be implemented by the POJO code.

It is generally a bad practice for POJOs to create threads. 




2 comments:

Jhon Gamboa said...

I need return a collection (List) in Java Callout Action, i recive only this content in any variable:

how i do for read or convert to list in OSB message flow ?

my escenary is, excecute un method in java callout, this method recive a colection and return a collection. i cant view estructur in message flow. only view <con:java-content…..

can any help me?

I need your help.
Regards
jgamboita@gmail.com

vernetto said...

keep it easy and return an Array