Tuesday, September 29, 2015

Human Tasks : Assign both users and groups in a single people assignment

Usual method of people assignment in WS Human tasks is using a logical people group. But it is not possible to assign to both people groups and users in a single logical people group. So in order to achieve this, you need to use literals as defined in WS Human Task Spec.

Following is a sample of assigning both groups and individuals inside same people assignment to potential owners. I have used and tested this in latest WSO2 Business Process Server successfully.

Wednesday, July 22, 2015

WSO2 BPS : Business process monitoring with WSO2 Analytics

Business process  information can be monitored using WSO2 Data Analytics Server (DAS). For this an event stream should be published to DAS. WSO2 BPS 3.5.0 supports publishing to DAS 3.0.0.

Publishing data to DAS from BPS requires following steps. They are explained using the KPI sample in WSO2 BPS samples.

  1. Configure DAS publishing extension.
  2. Implement a business process with the configurations to publish the data to DAS.
  3. Run the BPEL process and publish data to DAS.
  4. Monitor information via DAS.

Configure DAS publishing extension

Add the following extensionActivity to bps.xml, which is located in /repository/conf/directory.

Create the BPEL process to publish data to DAS


In order to specify the server configuration details, and monitoring data (Payload, Correlation and Meta), BPS uses an XML configuration file. This configuration file should specify the BPEL process in the deploy.xml file (deployment descriptor file for a BPEL package). The analytics server profile is specified using  element <analyticsServerProfiles>. Observe the analytics profile in the following deploy.xml. The ‘file:‘ in location is used to specify the file path to analytics server profile.
Let's create the analytics server profile. It takes the following xml structure.


The connection element is used to describe the Analytics server information. Credential element describes the authentication info to authenticate to the Analytics server. Under the element, many Analytics streams can be defined. The following is the structure for a Analytics stream definition.



A DAS definition should have the properties, ‘name’, ‘version’, ‘nickName’ and ‘description’. Under the <stream> element, each of the data items published to analytics server is specified using the child element <data>.
The name attribute of the element describes the key used by analytics server to identify the given data item and the type attribute describes the type of data item. Analytics server has three types of data. They are meta data, payload data and correlation data. This can be specified using the type attribute. The standard From syntax from BPEL is used to select the value of each key. When selecting a variable to be published to DAS, it can be specified as <From variable=”quantity”/>. The variable name should be the same name used in the BPEL process. The following is a complete example of an AnalyticsServer Profile.


Run the BPEL Process and publish data to Analytics server

When developing the BPEL process, the following information should be included in the BPEL process in order to DAS publishing to work. Under the process element in the BPEL script, define the DAS publishing extension.


Also include the namespace found in http://wso2.org/bps/monitoring/publisher in the process declaration. Now, in the location where you want information published, include the following extension activity section.



The publish element describes the name given to the Analytics server profile and the corresponding stream definition to get the configuration data. If all configurations are done correctly, when you run the BPEL process, the data is published to Analytics server.

Monitor information via DAS

KPI sample shipped with WSO2 BPS is a bpel process can submit event information to the Analytics server. Let's setup the sample.
  • Start DAS without a port offset.
  • Download and unzip BPS.
  • Configure the bps.xml file in the repository/conf directory of bps by adding the DAS publishing extension as mentioned in step 1.
  • Configure a port offset of 5 in carbon.xml.
  • Upload KPIProcess.zip BPEL process in /repository/samples/bpel to BPS.
  • Now click on the services list and send the KPISampleProcess request as mentioned below using tryit editor. Send few more requests.
  • Send a few request to the BPS process. It would publish this data to DAS and deploy a new stream definition with id ‘org.wso2.bam.phone.retail.store.kpi:1.0.0’.
  • Log into DAS, click on the Streams under Manage tab to check the created stream definition.
  • Click edit under actions column. This will show all the information of the event stream. Do not change anything here for this sample. It will change the stream.
  • We need to persist the data received from  BPEL process in order to analyse them. Click on the ‘Next[Persist Event]’ button at the bottom.
  • Select whatever data you need to persist from here and click save stream. 
  • We need to add a event receiver to populate the table we created, with data received from BPEL process. Click on ‘Receivers’ under Manage tab. Click on ‘Add Event Receiver’. 
  • Fill the form with following information.
  1. Event Receiver Name :
  2. Adapter type : wso2event
  3. Event stream - org.wso2.bam.phone.retail.store.kpi:1.0.0
  4. Message format - wso2event
  • Submit the form to create new event receiver from bps.
  • Now we have setup the infrastructure to receive and analyse event information from BPS. Let’s create a dashboard to visualise the KPI data. Create a new Dashboard in DAS as instructed in Adding a Dashboard.
  • Now follow the instructions in  ‘Adding a gadget using the gadget generation wizard’ section in page Adding gadgets to a layout. Select ‘ORG_WSO2_BAM_PHONE_STORE_KPI’ as the datasource here. You can create different types of charts and use different data combinations here.
  • Add the new gadget to your dashboard.



Now you can visualise the event information using the Analytics Dashboard. Try sending more requests to the BPEL process and note the changes in charts.


Thursday, June 18, 2015

WSO2 BPS : Skippable Human Tasks

A human task can be skipped by a business admin of that task. In order to make a human task skippable you need to edit the corresponding BPEL process that invoke it. It is not a property of the Human Task.

In order to invoke a human task in WSO2 BPS, we should include a people activity, such as shown in following snippet from a BPEL process definition.



Note that there is a attribute called 'isSkipable' inside peopleActivity element. This attribute is by default set to 'no' if the process is created using WSO2 Dev Studio. Changing it to yes will make the human tasks invoked by the particular process skippable.

Cheers!

Tuesday, June 2, 2015

WSO2 BPS : Working With Multiple User Stores in Human Tasks

In a human task you need to assign task's to users. In a multiple user store, there are multiple user domains. With the multiple user store support in WSO2 carbon platform (WSO2's middleware platform), WSO2 Business Process Server allows to assign human tasks to users in different domains.

First we need to understand the basic user store concepts. Among the user stores, one of them is considered as the primary store and others are secondary stores. A user in a primary user store can be referred directly by it's user name. But users in secondary domains should be referred with the respective user domain in following format.
                                   <domain name>/<username|rolename>    

When you assign a task inside your humanTask package or Process archive to a domain user you should use the above format. domain names are case insensitive.

Eg: Lets assume you have ‘ClerkUser’ in ‘abc.com’ domain and ‘ManagerUser’ in primary domain.
So If you are assigning any task to these users they should be referred as follows,
ClerkUser : abc.com/ClerkUser
   ManagerUser : ManagerUser

Please note that these domain names are case insensitive. You can use any form inside your process package.
That's all you need, to work with multiple user stores in WSO2 BPS.

If you want to try this out, setup a new user store as explained in Working with User Stores. Then deploy the ClaimsApprovalTaskWithMultipleDomains.zip human task package in the <BPS_HOME>/repository/samples/humantasks folder inside the WSO2 BPS 3.5 release. Read the sample section of the documentation for more info.

Thank you.

Thursday, May 7, 2015

BPEL : Populating a Complex Element List

Apache ODE has insert-as.. XPath extension functions to add elements to a list inside a business process.

You can select the function based on where the new elements should be added. For an instance, insert-as-last-into() insert elements at the end of the list and insert-as-first-into() add elements to the front of the list.

Following code snippets demonstrates the usage of the functions.



Let's assume that the variable input has multiple parameter elements. We need to add each element to a list called elementList. Here the ode:insert-as-last-into() function is used.

Insert function should be used inside a copy operation. The first argument is the variable that represents the list. Second one is the element that is going to be added. Finally the bpel:to part of the copy operation should be again the list that we are inserting elements.

This looks like a straight forward task. But when I use this for the first time, I ran into bunch of problems. So here are the tricks that you need to aware when using these functions.

1. You need to use following xpath 2.0 related queryLanguage and expressionLanguage,             
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"                    
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"

2. You can only insert directly into a list. Not a list inside another parent element.
For an instance, you can't directly insert into a list that is inside a message part. It will result in       selection failures. You need to define a local list variable, populate that local list and copy the             whole list later.

Hope this is all you need.

I have tested this with the WSO2 BPS Server. Leave a comment if you have any queries.

Cheers!