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:
BookWarehousingBPEL.bpel
process.<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).<assign>
activity as AssignAlarmEventCallback, as shown in the following screenshot:<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:<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.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:<exit>
activity to terminate the execution of the BPEL process: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:
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.