The out-of-the-box actions implemented in JBoss ESB are divided into the following functional groups:
org.jboss.soa.esb.actions.SystemPrintln
. This action prints off a message.We'll examine each of these groups of out-of-the-box actions in the sections that follow.
Scripting actions make it possible for you to actually create custom actions, from within an OOTB action, by writing the custom code using a scripting language. This approach mirrors the way in which scripting languages are being used instead of compiled code to greater and greater degrees every year. As of release 4.10 of JBoss ESB, the following scripting actions are supported:
org.jboss.soa.esb.actions.scripting.GroovyActionProcessor
The name is a dead give-away; as this action enables you to use Groovy scripts. Here's an example of an action that invokes the OOTB GroovyActionProcessor
action:
<action name="groovyHelloWorld" class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor"> <property name="script" value="/scripts/helloWorld.groovy" /> </action>
org.jboss.soa.esb.actions.scripting.ScriptingAction
This action enables you to use the Bean Scripting Framework
(BSF—http://jakarta.apache.org/bsf/). This framework supports BeanShell, Jython, and JRuby scripts. Here's an example of an action that invokes the OOTB ScriptingAction action:
Pay attention to the comment. If you use a .bsh
file extension, the BeanShellDeployer (this is a tool that enables you to deploy scripts or services for one-time use—see http://community.jboss.org/wiki/BSHDeployer) will deploy the script.
As we've mentioned more than once already, one of the great strengths of JBoss ESB is how it makes it possible for you to integrate different types of services and systems together, and have them communicate through a loosely coupled architecture, by sending messages over the ESB. One way in which JBoss ESB makes this integration possible is by enabling you to interact with EJBs.
The EJBProcessor (org.jboss.soa.esb.actions.EJBProcessor
) action accepts a message and uses it to locate and invoke an EJB. You can send parameters to an EJB and retrieve values from EJBs. Let's look at an example of an action that invokes an EJB, and sends it parameters.
<action name="EJBTestVoid" class="org.jboss.soa.esb.actions.EJBProcessor"> <property name="ejb3" value="true" /> <property name="method" value="printMessage" /> <property name="jndi-name" value="SimpleSLSB/remote" /> <property name="initial-context-factory" value="org.jnp.interfaces.NamingContextFactory" /> <property name="provider-url" value="localhost:1099" /> <property name="ejb-params"> <arg0 type="java.lang.String"> org.jboss.soa.esb.message.defaultEntry </arg0> </property> </action>
What's interesting to note here is that in order for the EJBProcessor
action to be able to locate the EJB and find the right method to invoke, the parameter list includes as message properties the EJB's jndi-name
, its initial-context-factory
and the other parameters needed by the EJB.
There are three web service-related out-of-the-box actions in JBoss ESB. Each serves a different function and they are detailed in the following:
SOAPProcessor
: This action is used to expose web service endpoints. Write a service wrapper web service (JSR181) that calls your target web service and exposes it through JBoss ESB listeners. These three types of JBoss WS web service endpoints can be exposed through JBoss ESB listeners using this action:WISE SOAPClient
: This action uses the WISE client service to create a JAX-WS client class and then call the target service. The message is then routed to that service.SOAPClient
: This action uses the soapUI client service to create a SOAP message and then route that message to the target service.