Tuesday, October 27, 2015

View WSO2 BPS-ODE related db tables of H2


In order to view the inbuilt H2 db- ode tables of wso2 bps you need to follow these steps.

1. Unzip bps pack and go to <Product_Home>/repository/conf/ carbon.xml.

2. Uncomment H2 db configuration like below.

<H2DatabaseConfiguration>
        <property name="web"/>
        <property name="webPort">8082</property>
        <property name="webAllowOthers"/>       
</H2DatabaseConfiguration>

3. Start bps server and go to http://localhost:8082

4. Log in with following details .


JDBC URL: jdbc:h2:<file path to CARBON_HOME>/repository/database/jpadb
username: wso2carbon
password: wso2carbon

Friday, October 9, 2015

Performing operations with BPMN 2.0-Service Task

BPMN 2.0 is a standard / language to execute workflows.  Just like WS-BPEL ,BPMN can be used to create a process model, that contains a series of activities to be executed. In WSO2- BPS 3.5.0 release, bpmn suppport is introduced, which uses Activiti as the engine. To get a general idea on how/when bpmn can be used, you could go through https://docs.wso2.com/display/BPS350/BPMN+Samples


In this blog post, we will look at how to execute the services introduced by Activiti within a service task of our own. Service task is a type of task provided in bpmn, which is simply a java class. In a practical scenario, a service task is used to perform actions such as reassigning a user for a task, creating new tasks, delegating tasks etc. These operations can be done quite easily with the services provided by Activiti. [1] [2]

Let us take an example. We have a certain task (approve vacation request) that is assigned to admin user by default, and if he does not complete his task within a given time duration ( 2 days   ) we are going to assign it to another user.  In order to get this working with bpmn, you need to address below points.

1. Include a time out on "approve vacation request"task. : TimeBoundary Event
2. On time out call a service task to perform the delegation :  Service Task

Therefore , you would need to process your model with something similar like below.



Now that you have the basic model designed, let us look into the next level of details.  So in this scenario your "Approve Vacation Request" tasks main configs-> assignee would be set to 'admin'.Also you can set the duration of your timeBoundaryEvent. In your service task you need to address these points.

1. Get  the task with the task name as "Approve Vacation Request" and  is assigned to a user named 'admin'.
2.  Delegate that queried task to a new user. (Here you can pass the new user directly, or you could pass a form variable with execution.getVariable() )

Following is a sample  service task written to execute above points.  Here we are using methods provided by the TaskService Of Activit[1], so you would need to create an instance of the TaskService first.

  • Next by using this taskService, we are creating a query that search for  a task with the relevant task name ,and that is assigned/(or is a task candidate) to a user called admin.
  • Then we get the queried task list, and for each available task we would set the new assignee by executing method setAssignee().

As you can see it is a matter of fact getting to know the available services/ methods of activiti ,and you could create your own service task that could automate many processes easily. If you need to deploy this sample, other than deploying the .bar file in BPS management console, you need to create the jar of the service task and add it to <product_home>/repository/components/lib folder.

[1] http://activiti.org/javadocs/org/activiti/engine/TaskService.html
[2] http://activiti.org/javadocs/org/activiti/engine/RuntimeService.html