In this article I will discuss about the PICK activity in BPEL process. Pick activity has two operations a�� On Message and On Alarm.A�Pick activity gets triggered only when BPEL process invokes partner link. It waits for an operation from partner link or executes another set of activities on timeout.
- Create a SOA project with synchronous BPEL process. Open the BPEL process and drag and drop a partner link in the right swim lane. Double click on partner link to edit the property. Enter the WSDL URL of Asynchronous BPEL example. This asynchronous BPEL activity has 30 seconds wait time to display the result.A�The Wait activity allows a process to wait for given time.
- Now invoke the partner link through Invoke activity.
- Drag a wire between invoke activity and partner link and editor window of invoke will open. Partner link and port type will be selected automatically. If you want, you can select partner link manually also. Create an input variable of invoke activity.
- Drag and drop an Assign activity between receiveInput and invoke activity and do the mapping between input payload & input variable of invoke activity.
- Now use PICK activity to select between on message and on alarm operation.
- Click on clock icon to add on alarm operation
- Double click on OnMessage part to open editor window. Create a variable and browse PickPartnerLink partner link. Now click on OK button.
- Edit OnAlarm operation also. Enter 40 seconds time for OnAlarm operation.
- Drag and drop Assign activities under both operations. Map OnMessage input variable to output payload in one assign activity under OnMessage and assign a�?On Alarm is executeda�� to output payload in another assign activity under OnAlarm.
- Save the application. BPEL process will look like below screenshot
- Deploy the project and test it in EM console. This time OnMessage operation will execute as wait time is less in OnMessage operation than OnAlarm operation.
- Test OnAlarm operation also. Decrease the wait time in OnAlarm to 20 seconds.
- Test this application again. This time OnAlarm operation will execute. Enter any input string and see the output.
Pick activity will select the operation which will execute fast. You can execute different operations using OnMessage activity. Refer this article