📜 ⬆️ ⬇️

Implementing the event mechanism in Oracle BPM

If your customers, external or internal, have never required you to provide a certain way to initiate the BPM process, be sure that this moment is not far off. You may be asked, for example, to start a process with some kind of trigger, such as receiving an email, or requesting an external system, or a schedule event.

I will not torment you for a long time - Oracle BPM can do all this and much more. A business process can be started by a web service (synchronous or asynchronous call), using the Java Message Service, using the BPM Process Engine API, e-mail, a certain point in time, as well as subscribing to certain events, regardless of which interface the message source system uses.

image
')
In some integration environments, it is important to abstract as completely as possible from direct interaction with end-system services. In such cases, the exchange of messages between them can occur through an event mechanism. The event, in this case, occurs as the result of a certain action, for example, receiving a letter, registering a client's request, completing one of the stages of processing client data, and has a certain type of data message. This message, in turn, is registered or published in the appropriate infrastructure, which is responsible for its further delivery to all interested recipients. In order for the system to be able to receive a message as a recipient, it needs to have a subscription to an event that uses this type of message. So we can add as many subscribers as we like without worrying about the integration interface of the message source system.

In the Oracle integration platform, the Event Delivery Network (EDN) platform serves as an infrastructure for publishing events and delivering messages to recipients. On the following link you can get detailed information about this platform. In our example, we use its capabilities to initiate the process through an event.

In this article, I will demonstrate how you can implement this approach using Oracle technologies. To do this, we need to deploy the development environment of the current release 12c on our machine. I note that with the advent of this release to do it quite simply. With just one installation wizard, you can deploy the development environment, database and server with the infrastructure necessary for the work of BPM. From the following link you can download the installation package itself and the detailed instructions for deploying the environment.

In Oracle BPM, eventfulness is implemented through the activity of Signal, which actually has a slightly larger range of application than just the initialization process. In general, this activity provides an event-based messaging model between processes and, depending on the context, can perform the following roles:

1. Starting BPMN process (Start Events) - the process starts as a certain type of event occurs;
2. Broadcast events in the course of the work process (Throw Events) - the event is published on the EDN platform, later EDN delivers the event to all subscribers subscribed to it;
3. Catch Events - in this case, the process flow will wait for the event to which it is signed, a similar behavior model can be applied when you need to implement the exchange of messages between several running processes, more detailed information about this can be found at this link ;
4. Event Broadcast at End of Process (End Events) - the event is published on the EDN platform at the time of completion of the process.

In our case, we will use Signal in the context of running the BPMN process. Two examples are needed for our example to work:

Accordingly, as the first process - the translator, we will create the process in the BPEL annotation, and as the 2nd process we will create the BPMN process.

First, we implement the event subscriber process. Open JDeveloper and create a BPM application (select the “BPM Application” template from the gallery): specify “Samples” as the application name, “PubSubPr” as the project name (in the future we will use this test case in other Oracle BPM articles ). The next step we need to define our event:

1. Right-click on the “PubSubPr” project, select the “New” option and select the Event Definition (Service Components) template from the gallery;
2. In the “Wizards” window that will open, specify the name “SampleEvent” as the name;
3. Using the green plus, add the data schema of our event, call it QuoteRequestEvent, and select the QuoteRequest type available from the xsd Quote schema of the public example Sales Quote Demo as the data schema:

image

4. Let's create a simple interactive process without a task for a person, with one single role “Manager”:

image

5. Create a quoteRequest process variable with the QuoteRequest type:

image

6. Change the process start type to Signal:

image

7. Specify the previously created event that will initiate this process:

image

8. After that, you need to create a data mapping from the received event into the quoteRequest process variable:

image

Now let's start creating a BPEL process that creates an event:

1. Open the file with the composite (composite) diagram - composite.xml, containing our BPMN process:

image

2. Move the BPEL component to it, assign the name QuoteRequestEventService in the opened “Wizard” and set the values ​​according to the illustration below:

image

3. Transfer the invoke activity to the process and specify the Event as the Event, specify the previously created QuoteRequestEvent as the event, specify the RaiseQuoteRequestEvent_InputVariable as the variable, it will actually be the variable of our process:

image

4. In order to be able to initialize our event with the input data, we set an activity like Assign to the activity with the event, create the appropriate data mapping:

image

In order to test the created application, launch the Weblogic application server inside JDeveloper itself:

image

For more information on the Weblogic application server integrated in JDeveloper, see the following link .

After starting the server, we will deploy our application on the running server, using the default deployment descriptor:

image

To demonstrate the operation of our application, we need the Enterprise Manager, which is available to us via the link localhost : 7101 / em, open the deployed application - PubSubPr, and select the quoterequesteventservice_client_ep web service for testing:

image

Then check the history of the running process instances:

image

As we see, our process was launched through an event:

image

Source: https://habr.com/ru/post/257723/


All Articles