User Guide

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Extensibility Using Java Callouts and POJOs

To allow you to extend the capabilities of AquaLogic Service Bus in your organization, you can invoke custom Java code from within proxy services. AquaLogic Service Bus supports a Java exit mechanism via a Java Callout action that allows you to call out to a Plain Old Java Object (POJO). Static methods can be accessed from any POJO. The POJO and its parameters are visible in the AquaLogic Service Bus Console at design time; the parameters can be mapped to message context variables.

For information about configuring a Java Callout to a POJO, see "Java Callout" in Proxy Services: Actions in Using the AquaLogic Service Bus Console.

 


Usage Guidelines

The scenarios in which you can use Java Callouts to POJOs in AquaLogic Service Bus include the following:

Note: The input and return types for Java Callouts are limited to primitives and XmlObject.

Enterprise JavaBeans (EJBs) also provide a Java exit mechanism. The use of EJBs is recommended over the use of POJOs in the following cases:

For outbound messaging, BEA recommends that you write a custom transport instead of using POJOs or EJBs.

 


Best Practices

POJOs are registered as JAR resources in AquaLogic Service Bus. For information about JAR resources, see JARs in Using the AquaLogic Service Bus Console.

In general, BEA recommends that the JARs are small and simple—any large bodies of code that a JAR invokes or large frameworks that are made use of are best included in the system classpath. Note that if you make a change to the system classpath, you must reboot the server.

BEA recommends that you put dependent and overlapping classes in the same JAR resource; put them in different JARS if they are naturally distinct. Any change to a JAR causes all the services that reference it to be redeployed—this can be time consuming for your AquaLogic Service Bus system. The same class can be located in multiple JAR resources without causing conflicts. The JARs are dynamically class loaded when they are first referenced.

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.


  Back to Top       Previous  Next