Time for action – developing an event-driven book shelving BPEL process

To develop the event-driven book shelving BPEL process, we will go to the composite view. We will carry out the following steps:

  1. Drag-and-drop the BPEL Process service component from the right-hand side toolbar to the composite components area. We will do this the same way as in the previous examples in this book.
  2. The Create BPEL Process dialog box will open. We will select the BPEL 2.0 Specification, type BookShelvingBPEL for the Name of the process, and specify the namespace as http://packtpub.com/Bookstore/BookShelvingBPEL. Then, we will select Subscribe to Events from the drop-down list for the Template:
    Time for action – developing an event-driven book shelving BPEL process
  3. Next, we will need to specify the event to which our BPEL process will be subscribed. We will select the green plus sign and the Event Chooser dialog window will open. Here, we will simply select the BookshelfEvent business event:
    Time for action – developing an event-driven book shelving BPEL process
  4. After clicking on the OK button, we should see the following screenshot:
    Time for action – developing an event-driven book shelving BPEL process

    Note

    For event-driven BPEL processes, three consistency strategies for delivering events exist. The one and only one option delivers the events in the global transaction. Guaranteed delivers events asynchronously without a global transaction. Immediate delivers events in the same global transaction and the same thread as the publisher, and the publish call does not return until all immediate subscribers have completed processing.

  5. After clicking on the OK button, we can find the new BookShelvingBPEL process on the composite diagram. Please note that the arrow icon denotes that the process is triggered by an event:
    Time for action – developing an event-driven book shelving BPEL process
  6. Double-clicking on the BookShelvingBPEL process opens the BPEL editor, where we can see that the BPEL process has a slightly different <receive> activity, which denotes that the process will be triggered by an event. Also, notice that an event-driven process does not return anything to the client, as event-driven processes are one-way and asynchronous:
    Time for action – developing an event-driven book shelving BPEL process

What just happened?

We have successfully created the BookShelvingBPEL process. Looking at the source code we can see that the overall structure is the same as with any other BPEL process. The difference is in the initial <receive> activity, which is triggered by the BookshelfEvent business event, as shown in the following screenshot:

What just happened?

Have a go hero – implementing the BookShelvingBPEL process

Implementing the event-driven BookShelvingBPEL process does not differ from implementing any other BPEL process. Therefore, it's your turn now. You should implement the BookShelvingBPEL process to do something meaningful. It could, for example, call a service which will query a database table. Or, it could include a human task.

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

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