Pick activity is very important in BPEL. We use this activity in following cases.
- When we call asynchronous service and we need response back in certain time frame otherwise we need to throw exception.
- When we want to have multiple entry point for any composite. E.g. when we want our process when it is invoked by client or when any message is put to JMS queue by client.
Pick activity has two branches, OnMessage Branch and OnAlarm Branch which are explained below.
Out of these two branches, only one will execute.
OnMessage is same as Receive activity. It is used when we need to receive message from external system.
OnAlarm branch is used when we want to specify exp
iry time.
STEP2:Pick Activity Use Case 2::
In my I discussed about first use case for pick activity (When we call asynchronous service and we need response back in certain time frame otherwise we need to throw exception).
In this post, I will discuss about second scenario and show one use case of that.
In this scenario, we will have more than one entry point to same composite i.e. same composite can be invoked either by web service call or through JMS queue.
For this post, you need to add two services in the composite, one for web service and other for JMS Queue.
Add a BPEL process to the composite and wire both the services to the BPEL.
Now open BPEL process and drop Pick activity to it. Since we have two entry points for this composite so add one more OnMessage branch to it.
Make sure you select “Create Instance” box for that pick activity so that it can create BPEL instance, if you don’t check this option then you will not be able to compile your code.
Now go to first OnMessage branch and add partner link reference.
Do same steps for second OnMessage branch.
Once done, add required activities in both the branches. If you don’t add any activity inside any of the branch then you will not be able to compile your code.
Now deploy your composite.
Testing Result:
Let’s first test by web service call, go to EM console and test the composite. To test second entry point put message to JMS queue.







No comments:
Post a Comment