Red Hat Training

A Red Hat training course is available for Red Hat Fuse

BPEL Development Guide

Red Hat JBoss Fuse

BPEL

Red Hat

Version 6.3
16 Jul 2018

Abstract

Use this guide to help you develop integrated applications with SwitchYard.

Chapter 1. Introduction

1.1. Understanding BPEL

Business Process Execution Language (BPEL) is an XML-based language that enables task-sharing in a distributed computing environment. It uses easy-to-understand commands that perform complex functions. All the processes in BPEL, export and import information by using web service interfaces only.
The BPEL Engine is optimized for the JBoss Application Server container. It is based on Apache Orchestration Director Engine (ODE) and manages process definitions and instances.
Important
BPEL (based on the Riftsaw project) is no longer being actively developed and will be removed from a future release of JBoss Fuse. If you are currently using BPEL, it is recommended that you consider migrating to the Red Hat JBoss BPM Suite (which is supported through the JBoss Fuse Integration Package).

1.2. About Business Process Orchestration

Business process orchestration refers to the act of specifying actions within business processes via web services.
BPEL is mainly used to model web service interactions on a distributed system. It allows for complex orchestrations of multiple service applications through a single controller service.

1.3. About Apache ODE

Apache ODE ("Orchestration Director Engine") is a software component that is designed to execute BPEL business processes. It sends and receives messages to and from web services, manipulates data and performs error handling in the method prescribed in your process definition. To learn more about Apache ODE, visit the project website at http://ode.apache.org

1.4. Features of BPEL Engine

The BPEL Engine is based on Apache ODE and supports the following features:
  • Provides BPEL component within the SwitchYard.
  • Enterprise quality GWT based BPM console to manage process definitions and instances.
  • Compiled approach to BPEL that provides detailed analysis and validation when deployed.
  • Short-lived and long-running process executions.
  • Process persistence and recovery.
  • Process versioning.
  • Runs in JBoss Cluster.

Chapter 2. BPEL and SwitchYard

2.1. Introduction

The BPEL Component is a pluggable container in SwitchYard that allows you to expose a WS-BPEL business process as a service through an interface defined using WSDL.
Important
BPEL (based on the Riftsaw project) is no longer being actively developed and will be removed from a future release of JBoss Fuse. If you are currently using BPEL, it is recommended that you consider migrating to the Red Hat JBoss BPM Suite (which is supported through the JBoss Fuse Integration Package).

2.2. Structure of a SwitchYard BPEL Application

For SwitchYard BPEL applications, the artifacts within the src/main/resources folder are structured differently. The switchyard.xml configuration file is located in the META-INF folder. However, the BPEL deployment descriptor (deploy.xml), and the BPEL process definition are located in the root folder. You can locate the WSDL interface definitions, and any accompanying XSD schemas in the sub-folders. You must ensure that the BPEL process and SwitchYard BPEL component configuration define the correct relative path for the artifacts.
Here is an example that shows the structure of the say_hello SwitchYard BPEL quickstart:
say_hello
    src/main/java
    src/main/resources
         META-INF
          switchyard.xml
       deploy.xml
       SayHello.bpel
       SayHelloArtifacts.wsdl
    JRE System Library [JavaSE-1.6]
    src
    pom.xml

2.3. Providing a Service with the BPEL Component

Procedure 2.1. 

  1. Define your process using WS-BPEL within JBoss Developer Studio (with JBoss Integration and SOA Development tooling installed).
  2. Define a WSDL interface for the BPEL service.
  3. Define a Deployment Descriptor using the ODE Deployment Descriptor editor bundled with JBoss Tools.
  4. Add the component containing the implementation and service interface to the SwitchYard configuration.

2.4. Example of BPEL Component Configuration

Here is an example of the component section of the SwitchYard configuration:
 <sca:component name="SayHelloService">
        <bpel:implementation.bpel process="sh:SayHello"/>
        <sca:service name="SayHelloService">
          <sca:interface.wsdl interface="SayHelloArtifacts.wsdl#wsdl.porttype(SayHello)"/>
        </sca:service>
  </sca:component>
The BPEL component contains a single implementation.bpel element that identifies the fully qualified name of the BPEL process. This component may also contain one or more service elements defining the WSDL port types through which the BPEL process can be accessed.
In the packaged Switchyard application, ensure that the BPEL process associated with this fully qualified name must be present within the root folder of the distribution, along with the deployment descriptor (deploy.xml). Here is an example of the deployment descriptor for the BPEL process referenced above:
    <deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
     xmlns:examples="http://www.jboss.org/bpel/examples">

    <process name="examples:SayHello">
     <active>true</active>
      <retired>false</retired>
      <process-events generate="all"/>
        <provide partnerLink="client">
          <service name="examples:SayHelloService" port="SayHelloPort"/>
      </provide>
    </process>
    </deploy>

2.5. Consuming a Service from a BPEL Process

To enable a BPEL process to invoke other services, you need to define the WSDL interface representing the service to be consumed, using an invoke element within the deployment descriptor. For example, in the deploy.xml file:
  <process name="ls:loanApprovalProcess">
      <active>true</active>
      <process-events generate="all"/>
      <provide partnerLink="customer">
        <service name="ls:loanService" port="loanService_Port"/> 
      </provide> 
      <invoke partnerLink="assessor" usePeer2Peer="false"> 
        <service name="ra:riskAssessor" port="riskAssessor_Port"/> 
      </invoke> 
  </process>
Here, the usePeer2Peer property informs the BPEL engine not to use internal communications for sending messages between BPEL processes that may be executing within the same engine, and instead pass messages through the SwitchYard infrastructure.
For each consumed service, you can then create a reference element within the SwitchYard configuration to locate the WSDL file and identify the port type associated with the required WSDL service or port, as shown in the switchyard.xml file below:
  <sca:component name="loanService">
      <bpel:implementation.bpel process="ls:loanApprovalProcess" />
      <sca:service name="loanService">
        <sca:interface.wsdl interface="loanServicePT.wsdl#wsdl.porttype(loanServicePT)"/> 
      </sca:service> 
      <sca:reference name="riskAssessor"> 
        <sca:interface.wsdl interface="riskAssessmentPT.wsdl#wsdl.porttype(riskAssessmentPT)"/> 
      </sca:reference> 
  </sca:component>

2.6. Property Injection into a BPEL Process

You can inject properties into your BPEL process definition by using the SwitchYardPropertyFunction.resolveProperty() XPath custom function. The bpel:copy section copies Greeting property value into the ReplySayHelloVar variable in example shown below:
  <bpel:copy>    
    <bpel:from xmlns:property="java:org.switchyard.component.bpel.riftsaw.SwitchYardPropertyFunction"
      expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
       <![CDATA[concat(property:resolveProperty('Greeting'), $ReceiveSayHelloVar.parameters/tns:input)]]>
    </bpel:from>
    <bpel:to part="parameters" variable="ReplySayHelloVar">
      <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result]]></bpel:query>
    </bpel:to>
  </bpel:copy>  

Chapter 3. Administering Your System with BPEL Console

3.1. About the BPEL Console

The BPEL Console is a web based interface to manage, administer and debug processes deployed on a BPEL Server. It enables you to run, test and manage BPEL processes.
It allows you to view:
  • any process definitions you have deployed to the BPEL engine
  • the process instances executing in the BPEL engine
  • a process execution history
  • the query pertaining to the execution history
Important
BPEL (based on the Riftsaw project) is no longer being actively developed and will be removed from a future release of JBoss Fuse. If you are currently using BPEL, it is recommended that you consider migrating to the Red Hat JBoss BPM Suite (which is supported through the JBoss Fuse Integration Package).

3.2. Process Definition

A BPEL Process Definition is an XML file that acts as a template for a process. When deployed as a part of the SwitchYard application, you can access the BPEL process through various bindings supported by SwitchYard. For instance, as a web service via the SOAP binding or via a JMS queue.

3.3. Deploying Process Definition

The BPEL process definitions are deployed as a part of the packaged SwitchYard application. When deploying the SwitchYard application, ensure that it contains one or more BPEL process.
All the BPEL processes are displayed under the list of deployed process definitions in the console.

3.4. Manually Undeploy a Process

Procedure 3.1. task

Execute the following to safely undeploy a process:
  1. Launch a web browser and navigate to http://localhost:8080/bpel-console.
  2. Enter your user name and password.
  3. Click on the Runtime tab.
  4. Select the Deployments option. You will now be able to see the version information and current status (active or retired) of each process definition.
  5. Check if there is any active process consisting of any unfinished instances, retire the process.
  6. Undeploy the process only when there is no active process instance.
Warning
Undeploy the BPEL process only when the containing SwitchYard application is undeployed.

3.5. Active Process Instance

An active process instance is one execution of a process definition.
When you select a process definition, BPEL console displays the list of active process instances for that particular process version and definition.

3.6. View the Process Version

Procedure 3.2. task

To view the process version, execute the following:
  1. Launch a web browser and navigate to http://localhost:8080/bpel-console.
  2. Enter your user name and password.
  3. Click on the Managed Instances tab to see which BPEL processes are currently deployed. The process version information for each of these processes is also visible.
  4. Only one version of a process can be active at a time. When you open a process definition, the active version is automatically selected.
Note
BPEL console enables you to select a different version of a process.

3.7. About Business Process Analytics Format

The Business Process Analytics Format (BPAF) is designed to provide you with information about the efficiency and effectiveness of your organizational processes. It is an XML-based interchange format for all the process audit events.

3.8. View the BPAF Data

Procedure 3.3. task

You can view the Business Process Analytics Format (BPAF) data with the BPEL console. Execute the following:
  1. Launch a web browser and navigate to http://localhost:8080/bpel-console.
  2. Enter your user name and password.
  3. Click on the Managed Instances tab to see which BPEL processes are currently deployed. The process version information for each of these processes is also visible.
  4. Select a process definition to open it.
  5. Use the Execution History to produce a chart. Here you can specify a particular period of time to review and choose whether or not to include failed and terminated instances in the chart.

3.10. Configuring Logging Functionality

Procedure 3.4. task

Execute the following to activate the BPEL Web Console's Logging Functionality:
  1. Open the deploy.xml file in a text editor.
    Note
    deploy.xml file exists with every BPEL deployment unit.
  2. Configure the deploy.xml file as follows:
    <deploy xmlns="schemas"
        xmlns:bpl="examples"
          xmlns:intf="examples/wsdl">
            <process name="bpl:HelloGoodbye">
               <active>true</active>
               <process-events generate="all"/>
               <provide partnerLink="helloGoodbyePartnerLink">
               <service name="intf:HelloGoodbyeService" port="HelloGoodbyePort"/> 
               </provide>
            </process>
    </deploy>
    Note
    Add the process-events element to generate all the events. For more information, navigate to the Apache ODE events http://ode.apache.org/ode-execution-events link.
  3. Save the file and exit.

3.11. View the Instance Data

Procedure 3.5. task

Execute the following to view instance data with the BPEL Console:
  1. Launch a web browser and navigate to http://localhost:8080/bpel-console.
  2. Enter your user name and password.
  3. Under the Managed Instances tab, select the Open Button list to view the deployed process definitions. When you select any one of the process, it displays the list of process definitions and version of that particular process.
  4. Select a process instance to open it. You can see its details in the Execution Details panel.
  5. Click the Instance Data button. It displays all the details about the process.
  6. Click the Execution Path button. It opens the related instance execution graph.
    Note
    The instance execution graph is a visual representation of a running instance of a process. It tells the user about the process instance's performance over time.
  7. The View tab shows the instance execution graph, while the Source tab below it shows all of the "activity" events.

3.12. View a History Instance Query

Procedure 3.6. Task

  1. Log into the BPEL Web Console.
  2. Choose a process definition and a process status from the list box.
    You can also optionally choose to input the correlation key, the start time and the end time as search criteria.
  3. Go to the History Instances List and double-click on a row. A window will pop up showing you all of the execution events that happened when that process ran.

3.13. Active Process Definition

When you deploy the first version of a BPEL process definition, it automatically becomes the active definition. If this definition is subsequently changed and redeployed, then that version is "retired", and a new version becomes active automatically.

3.14. Retired Process Definition

If the active process definition is changed and redeployed, the old version is "retired". The new version automatically becomes active. The only difference between an active version and a retired one is that a retired one can no longer create new process instances. However, if there are active process instances associated with the retired process version, then these will continue to run.

3.15. Manually Retire an Active Process Definition

Procedure 3.7. Task

  1. Launch a web browser and go to http://localhost:8080/bpel-console.
  2. Input your user name and password.
  3. Click on the Runtime tab.
  4. Select the Deployments option.
    You will now be able to see the version information and current status (active or retired) of each process definition.
  5. Select the particular version of the process definition you want to retire and then press the Retire button.
    Note
    If you undeploy a process, its end-points will only deactivate if no previous versions of that process have ever existed.

3.16. Enable Execution Events

The BPEL Engine generates events to let you track all the activities happening within the engine and produces detailed information about all the process executions. These events exists in the database and can be examined.

Procedure 3.8. task

When you run a process, Apache ODE generates a set of events. To achieve the satisfactory performance, you can deactivate few events that are not in use. All the events may cause a non-negligeable overhead.
To enable these events, execute the following:
  1. Open the deploy.xml file in a text editor.
  2. Add <process-events generate="all"/> parameter in the deploy.xml file.

Result

Events are successfully enabled.

Chapter 4. Configuring the BPEL Engine to Run in a Clustered Environment

4.1. About BPEL Engine in a Clustered Environment

To enable the BPEL Engine to run in a clustered environment, you need to configure all the nodes within a cluster. Ensure that all the nodes have access to the shared information concerning the persistent state of process instances.
Note
For setting up a cluster, you need to employ a load balancer to distribute the incoming SOAP requests appropriately across all of the nodes in the server.

4.2. Install the BPEL Engine in a Clustered Environment

Information Needed.

4.3. Deploying a BPEL Process in a Clustered Environment

In Fuse 6, the BPEL process is deployed as a part of a SwitchYard application. Therefore, the support for clustering is provided by SwitchYard.
Note
The switchyard.xml configuration file is located under the META-INF directory.

4.4. BPEL Process Service Invocation

When you invoke the BPEL service deployed in a clustered environment, make sure to specify the load balancer URL instead of SOAP address in the WSDL file. The load balancer then decides about the server, to invoke in the cluster.

Chapter 5. BPEL and REST

5.1. BPEL Console RESTful Services

5.1.1. BPEL Console RESTful Services

This is a list of Restful services that are used by the BPEL Console.

Table 5.1. BPEL Console RESTful Services

Method
Path
Description
Consumes
Produces
Server Info (General REST server information)
GET
/gwt-console-server/rs/server/status
*/*
application/json
-
GET
/gwt-console-server/rs/server/resources/{project}
*/*
text/html
Process Management(Process related data.)
GET
/gwt-console-server/rs/process/definitions
*/*
application/json
-
GET
/gwt-console-server/rs/process/definition/{id}/instances
*/*
application/json
-
GET
/gwt-console-server/rs/process/instance/{id}/dataset
*/*
text/xml
-
POST
/gwt-console-server/rs/process/instance/{id}/end/{result}
*/*
application/json
-
GET
/gwt-console-server/rs/process/definition/{id}/image
*/*
image/*
-
GET
/gwt-console-server/rs/process/definition/{id}/image/{instance}
*/*
image/*
Process Engine(Process runtime state)
GET
/gwt-console-server/rs/engine/deployments
*/*
application/json
Process History(Process History Service)
GET
/gwt-console-server/rs//history/definition/{id}/instances
*/*
applications/json
-
GET
/gwt-console-server/rs//history/definitions
*/*
application/json
-
GET
/gwt-console-server/rs//history/definition/{id}/instances
*/*
application/json
-
GET
/gwt-console-server/rs//history/instance/{id}/activities
*/*
application/json
-
GET
/gwt-console-server/rs//history/instance/{id}/events
*/*
application/json
-
GET
/gwt-console-server/rs//history/definition/{id}/instances/completed
*/*
application/json
-
GET
/gwt-console-server/rs//history/definition/{id}/instances/failed
*/*
application/json
-
GET
/gwt-console-server/rs//history/definition/{id}/instances/terminated
*/*
application/json
-
GET
/gwt-console-server/rs//history/definition/{id}/instances/chart/completed
*/*
application/json
-
GET
/gwt-console-server/rs//history/definition/{id}/instances/chart/failed
*/*
application/json

Chapter 6. BPEL Database

6.1. BPEL Database Schema Diagram

Following is the BPEL database schema entity relationship diagram.

Figure 6.1. BPEL Database Schema Entity Relationship Diagram

E-R diagram for BPEL database schema

Legal Notice

Trademark Disclaimer

The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Apache, ServiceMix, Camel, CXF, and ActiveMQ are trademarks of Apache Software Foundation. Any other names contained herein may be trademarks of their respective owners.