Oracle SOA- Subscribing to Human Task Events



In this post I,ll showcase how can a SOA composite application can subscribe to a human task event. So let's get started-


The functionality can be achieved by- Mediator Component or a BPEL Process


Sample Use Case-

Let's consider a scenario where I would like to send SMS/Email notifications whenever a human task is assigned to a user (typically onTaskAssigned event).

Consideration-

Our Weblogic server has been configured with smppdriver and is up and running. Please refer to this link  in case you are using smpp driver for the first time.

For this tutorial, I have taken consideration of human task subscription using a BPEL process and same can be used for Mediator component based implementation


I have used Oracle SOA Suite 11g in jDeveloper  11g & Weblogic Server 10.3.6


Implementation-

In this implementation I have taken the scenario of SMS notification,however same can be used for email notifications as well.

Step1- Create a MDS connection

We need a create a MDS connection to existing SOA server since further activities require data from MDS connection.




Step2- Create a BPEL process 'UserNotificationProcess' and select template 'Subscribe to Events'

Make sure you did not select (check) expose as a service.



Step3- Select event definition file 'edl'  and select event 'onTaskAssigned'





Please click on green plus '+' symbol below delivery to open Event Chooser


Select your MDS connection and expand up to HumanTaskEvent.edl file as shown in the screenshot below:




Now select this file and a dialog box will open to ask to selection of event. For this demo choose 'OnTaskAssigned' event:




Click 'Ok' & finish the BPEL process creation wizard.


Step4- Now check your BPEL process in composite editor




In above screenshot, you can see that BPEL process is connected to a Web Service named 'SendSMSApprover'. This means that I have separately created the SMS notification process and get this invoked based on use case. So my BOEL process will invoke this Web Service for sending SMS.


Step5- Now double click on your BPEL process and go for 'Orchestration Part'




Here as you can see that some vaules will be assigned to invoking web service. First I am calling a service to retrieve some values to be used in SMS calling web service. Then I have assigned values(Assign_SMSParams) to SMS alert service.




Last important point, kindly go to human task definition file and make changes on 'Events' tab by 'Check' mark 'Trigger Workflow Event' to state 'OnAssigned'.



 So now we are ready to invoke SMS alert service.

So curious about what orchestration inside SMS Alert service. Well, this is also a BPEL process and below is the implementation of the same:




So the implementation is simple (don't think complex as above diagram is scenario based implementation). Typically you need a assign activity followed by SMS activity. Now just configure the SMS activity params (as received from invoking service' like From, To, Message Body etc.) and that's it.


So coming back to original BPEL process, Save it and Deploy.


Step6- Testing 


Do testing via em console for respective composite and check the flow trace. You'll see OnAssignedTrigger and invocation of other BPEL process.




For SMS delivery, go to usermessaging server as shown in the screenshot and select Message Status from dropdown menu available by clicking on 'User Messaging Server' available in right lane at top.







And this completes the testing and the demo.


Note

Whatever activities has been carried out in BPEL process, the same can also be achieved using Mediator component and subscribing to events!



Comments

Popular posts from this blog

Oracle SOA Suite- Implementing Email Notification

Oracle SOA Suite 12c- PKIX path building failed & unable to find valid certification path to requested target

Migration of Oracle SOA Suite Composite from 11g to 12c