Time for action – specifying message event activities

To throw the fault and to exit the process, we will perform the following steps:

  1. Open the BookWarehousingBPEL process. We will drag-and-drop the <throw> activity to the message event handler scope.
  2. Name the <throw> activity ThrowCancelInstance.
  3. Double-click on the ThrowCancelInstance activity and then specify the Fault QName. The Namespace URI is the same as for the BPEL process itself: http://packtpub.com/Bookstore/BookwarehousingBPEL. The Local Part name should be CancelInstance. We will not specify the Fault Variable as the BPEL faults do not require a variable:
    Time for action – specifying message event activities
  4. Next, drag-and-drop the <exit> activity and place it after the <throw> activity. This way the process will terminate. We should see the following BPEL diagram:
    Time for action – specifying message event activities

What just happened?

We have added activities that will execute once the OnEvent message handler is triggered. We have decided to throw a fault and to exit the process instance. The following code has been generated:

What just happened?

With this, we have concluded our discussion on event handlers. We are now ready to deploy and test the example.

Deploying and testing event handlers

We will deploy the example process the same way as we did in Chapter 9, Human Tasks. Please note, however, that you should either check the overwriting of any existing composites with the same revision ID, undeploy the previous example, or use a higher revision ID; otherwise, you will get an error stating that you cannot overwrite an existing version of an SOA composite.

After the deployment, initiate a BPEL process instance. The instance should wait at the human task, which you can see from Flow Trace:

Deploying and testing event handlers

After 15 minutes, you will see that the alarm event handler has been triggered and the process has been aborted:

Deploying and testing event handlers

This confirms that our alarm event handler has been triggered. We can see that the termination happened exactly 15 minutes after the BookWarehousingBPEL process was invoked.

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

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