Time for action – specifying alarm event handler activities

Let's now add the activities that will execute within the alarm event handler. As we have already said, we will notify the client that an event handler has been invoked on the BPEL process.

To achieve this, we will perform the following steps:

  1. Open the BookWarehousingBPEL.bpel process.
  2. Before we can add the <invoke> activity, we will prepare the variable for the response message. To achieve this, we add the <assign> activity into the event handler body (using drag-and-drop).
  3. Rename the <assign> activity as AssignAlarmEventCallback, as shown in the following screenshot:
    Time for action – specifying alarm event handler activities
  4. By double-clicking on the <assign> activity, we will copy the literal string Alarm Event – 15 Minutes Timeout into outputVariable. As some web services can take longer than expected to return a response, it is important that a BPEL process is able to take time out and continue with the rest of the flow after a period of time:
    Time for action – specifying alarm event handler activities
  5. Next, we will drag-and-drop the <invoke> activity and place it after the <assign> activity. We will name the activity callbackClientOnEvent. Then, we will connect the <invoke> activity with the client partner link, which is located on the left-hand side of the BPEL process diagram.
  6. A pop-up window will open, where we have to specify the partner link, port type, operation name, and input variable used for the callback. We will use the BookWarehousingBPELCallback port type and select the onEvent operation (which we have already added). We will select outputVariable as the input variable of the <invoke> activity, as shown in the following screenshot:
    Time for action – specifying alarm event handler activities
  7. Finally, we will add the <exit> activity to terminate the execution of the BPEL process:
    Time for action – specifying alarm event handler activities

What just happened?

We have added an OnAlarm event handler to our BPEL process. We have specified that the alarm event will trigger 15 minutes after the BPEL process instance is initiated. The following code has been added to the BPEL process:

What just happened?

Adding a message event handler

Let's now add another event handler. As we have mentioned earlier, a typical scenario is to provide a way to cancel the BPEL process instance in progress. Let's suppose that we would like to provide a way to cancel a BPEL process instance with an operation call.

To achieve this, we will add a message event handler to the BPEL process.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset