Since BPEL 2.0, it is possible to extend the language by user-defined activities and custom variable assignment mechanisms. WSO2 BPS (>= 1.1.0) supports these extensibility mechanisms and provides a plug-in architecture that allows for registering third-party extensions.
BPEL extensions must be declared for use in the process preamble to tell the engine the mandatory and optional extensions. This can be done by adding an <extension> element to your BPEL process model. For example,
<bpel:process...> <bpel:extensions> <bpel:extensionnamespace="#extension-namespace#"mustUnderstand="#yes|no#"/> </bpel:extensions> ... </bpel:process>
This code snippet declares the given extension namespace and tells the engine what to do if no extension bundle is registered for this namespace. If "mustUnderstand" is set to "yes" and no extension bundle is registered, the engine complains during the deployment of the process model and refuses the execution of the process model. If "mustUnderstand" is set to "no", the engine logs a warning but continuous with deployment and execution. Unregistered extension activities are then executed like an <empty> activity.
- Extension Activities
<extensionActivity> <anyElementQName standard-attributes> standard-elements </anyElementQName> </extensionActivity>
- Extensible Assign Operations
<assignvalidate="yes|no"? standard-attributes> standard-elements <extensionAssignOperation> assign-element-of-other-namespace </extensionAssignOperation> </assign>
Using BPEL Extensibility in WSO2 BPS
In WSO2 BPS, extension activities and extension assign operations are grouped into Extension Bundles. Extension bundles are associated with an extension namespace and may provide several Extension operations. Extension operations are the actual implementations of extension code and can be used for both, extension activities and extension assign operations.
BPEL extensions are only available in WSO2 BPS 1.1.x and higher.
To install an extension, simply copy the extension jar to $PRODUCT_HOME/repository/components/lib directory. Then add a configuration entry to bps.xml in $PRODUCT_HOME/repository/conf directory as shown in the following example:
<bpsxmlns="http://wso2.org/bps/config"> ... <extensionBundles> <runtimes> <runtime>org.wso2.bps.samples.extension</runtime> </runtimes> <validators> <validator>class name of the validator</validator> </validators> </extensionBundles> ... </bps>
- For details of bps.xml file configuration and a description of its elements, refer to Configuring bps.xml.
- A sample extension implementation can be found here: http://svn.wso2.org/repos/wso2/branches/carbon/3.2.0/products/bps/2.1.0/modules/samples/product/bpel-extension/src/main/java/org/wso2/bps/samples/extension/