Thursday, April 28, 2016

[Sample] Order Processing Process

This sample illustrates usage of WS-BPEL 2.0, WS-HumanTask 1.1 and Rule capabilities in WSO2 Business Process Server and WSO2 Business Rule Server.

Order Processing Flow
alt text
  • The client place an order by providing client ID, item IDs, quantity, shipping address and shipping city.
  • Then Process submits order information to invoicing web service, which generates order ID and calculate total order value.
  • If total order value is greater than USD 500, process requires a human interaction to proceed. When a order requires a human interaction process creates a Review HumanTask for regional clerks. If review task is rejected by one of regional clerk user, workflow terminates after notifying the client.
  • Once the regional clerk approve the review task, workflow invokes Warehouse Locater rule service to calculate nearest warehouse.
  • Once receiving nearest warehouse, process invokes Place Order web service to finalize the order.
  • Finally user will be notified with the estimated delivery date.

This sample contains

Please checkout this sample from Github. 

Monday, January 11, 2016

[WSO2BPS] Hello World BPMN 2.0 Process

This tutorial will explain,
  • How to create a Hello World BPMN process using wso2 developer studio and Activiti eclipse designer.
  • Try Hello World BPMN process using WSO2 Business Process Server.



Creating Hello World BPMN Process and Hello World Service Task

1) In Eclipse, Create an Activiti Project.

2) Create an Activiti Diagram (a BPMN process)

3) Create following process by adding Start event, Service Task and End Event. Link each activity as shown below.

4) Create a Java project for HelloWorld Service Task.

5) Add activiti-all_5.19.0.wso2v2.jar ( or Later version ) to project build path as an external Jar. You can find this jar from /repository/components/plugins/activiti-all_5.19.0.wso2v2.jar.

6) Create a Java package called "org.wso2.bpmn.helloworld.v1"

7) Create Java Class for HelloWorld Service task implementation.

8) Add org.activiti.engine.delegate.JavaDelegate interface to your class.

9) Implement HelloWorld Service Task business logic.

10) Configure HelloWorld Service Task Class name in properties.

Best Practices :
  • When you create a Java Service Task, version your java package or classes by adding version number into Java Package path or Class name.
  • This is useful when you have multiple versions of same workflow and changing Service task business logic in each process version.

For example.

HelloWorld Process Version 1 - Service Task implementation.

HelloWorld Process Version 2 - Service Task implementation.

  • This will avoid affecting new or running process instances which are created from old process version, because of business logic change in service tasks.

Creating Deployment Artifacts

11) Create WSO2 Java Library project.

12 ) Add HelloWorldServiceTask Java project from workspace.

13 ) Create Composite Application Project.

14 ) Select HelloWorldServiceTask_Artifact as a dependency.

15 ) Select Business Process Server as HelloWorldServiceTask_Artifact's server role.

16) Export Capp.

17) Select Activiti Diagram and Export as an Archive file.

18) Rename file extension as ".bar". Select "Create Only Selected directories." Then Export.

19) Deploy Car file in WSO2 BPS server.

After successful deployment, you will see following logs, in console.

INFO {org.wso2.carbon.application.deployer.handler.DefaultAppDeployer} - OSGi bundle HelloWorldServiceTask_Artifact installed to Carbon Server.
INFO {org.wso2.carbon.application.deployer.handler.DefaultAppDeployer} - OSGi bundle HelloWorldServiceTask_Artifact successfully started on Carbon Server.

20) Deploy file

21 ) Login to BPMN-explorer (eg: https://localhost:9443/bpmn-explorer) ( admin/admin is default admin user credentials.). Start Hello World Process.

22 ) In console you will see "Hello World …!!!" string is printed.