To develop the event-driven book shelving BPEL process, we will go to the composite view. We will carry out the following steps:
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:BookshelfEvent
business event: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.
BookShelvingBPEL
process on the composite diagram. Please note that the arrow icon denotes that the process is triggered by an event: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: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:
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.