Saturday, August 27, 2016

Why are human tasks important for your business process?

Business processes can be considered as workflows ranging from a vacation approval process to a pizza ordering process. With WSO2 Business Process Server , you can easily create these workflows by creating your own BPEL processes.  BPEL is a standard to model your web service orchestration and you read more on it in [1] . In simple terms you can create a BPEL process to interact with different web services getting the responses that you need.  However there are scenarios where everything is not based on just sending a request and getting a response. Some business processes require a human touch.

For example if you consider a leave approving process, you need to send your request to probably your HR manager and wait until he/she approves/rejects your request. Your HR manager might do this right on that day or it could be next week. So until this decision is made, you have to hold back on booking your airline tickets for your vacation. Right? Wouldn't it be nice if you just get notified once the HR manager makes a decision?

Ok , so it is important.... but how to implement this?
Well as a developer  if you were to create a solution with above requirements it will not be an easy task. You need to know when a request was sent, need to make sure that the requests are sent to the correct person, need to keep track on when the HR manager approves/rejects it and finally need to let the employee know about the decision that was made. If it was just about calling a web service yeah sure you can model a BPEL process with few WSDLs but now a real user will be interacting in a step.  So how can we add this human interaction to a BPEL process ?  With WSO2 BPS server this is easily done through human tasks.

Does WSO2 BPS Server make it easy?
[2] is a really good blog on what human tasks are and how you can use it and explains the anatomy behind it with respect to WSO2 BPS. I suggest you first go through it. First you need to create your human task based on WS-HumanTask specification [3].  You can easily create it and deploy in WSO2 BPS which is explained in [4]. Once your human task is all set up, now you need a link to add this human task step into your BPEL process. With the use of  WS-BPEL Extension for People (BPEL4People) specification [5]  you could include your human task interaction to your BPEL process.

But now you might think it is a very tedious task to implement those specifications AND worry about the actual business process creation. But since WSO2 BPS comes with implementations of these specifications you only need to worry about creating those artifacts.

Link human tasks to the BPEL process
For example in your BPEL process when you add a bpel4people step, you could add a remote task partner link defining your human task details, so that once this step is reached, a human task will be created in the human task engine, and the BPEL  process will wait until that task is completed.

 <extensionActivity>
                    <b4p:peopleActivity name="TestTASKPeopleActivity"
                                        inputVariable="b4pInput"
                                        outputVariable="b4pOutput"
                                        isSkipable="no">
                        <b4p:remoteTask partnerLink="b4pPartnerLink"
                                        operation="approve"
                                        responseOperation="approvalResponse">
                        </b4p:remoteTask>
                    </b4p:peopleActivity>
                </extensionActivity>

Create Human Tasks in one go
 If you went through [4] you might feel that creating a human task is a bit of hectic process where you need to create all those files manually. But with WSO2 BPS 3.6.0 that is not the case! Now we have introduced  BPS tooling where you can create your human task in one go and it is really easy. You could check out the basics of this in [6].

Finally now you need to decide how you are going to create the UI for those human tasks?  You can easily create your own API with the admin services that are exposed through WSO2 BPS. Go through [7] for a good explanation on this.


[1] http://wso2.com/library/articles/writing-simple-ws-bpel-process-wso2-bps-apache-ode/
[2]http://wso2.com/library/articles/2012/01/human-tasks-bridging-bits-real-world/
[3] http://docs.oasis-open.org/bpel4people/bpel4people-1.1-spec-cd-09.pdf
[4] https://docs.wso2.com/display/BPS360/Writing+a+Human+Task+Artifact
[5] http://docs.oasis-open.org/bpel4people/ws-humantask-1.1-spec-cd-10.pdf
[6] https://codeoutloud.wordpress.com/2016/06/22/creating-a-human-task-artifact-with-wso2-bps-tooling/
[7] http://nandikajayawardana.blogspot.com/2013/05/how-to-implement-your-own-task-ui-on.html

No comments:

Post a Comment