It is difficult to imagine a completely isolated process, i.e. performing tasks without having to refer to external information sources, and in most cases the BPMN process is the orchestration of such calls. Moreover, it can apply both synchronously and asynchronously to integration application services, other BPMN or BPEL processes. A lot of real-world tasks require architects and developers to take a serious approach to the issue of organizing solutions to interact with the “outside” world and the matter here is not limited exclusively to an integration approach, it is important to maintain the context of such connections.
Oracle BPM offers such interaction mechanisms that are capable of supporting complex communication environments from disparate applications and processes, where, for example, concurrently running workflows can freely “communicate” with each other in the course of execution. So You can build a chain of relationships from the interdependent tasks of different processes, widely applying the so-called modular approach. The modular approach, in turn, saves a lot of time when developing and maintaining solutions, since modules can be developed and tested independently of each other and reused in different parts of the process.
In the form of modules, both BPMN and BPEL processes can act, allowing the reusable execution logic to be carried out into separate components and communicated with them through the interaction mechanisms provided. It may happen that in the future all your processes will be an orchestration of previously implemented modules, which reduces the work to the implementation of such tasks to a minimum, all your main attention will be focused on the organization of links between reusable components. Such intercomponent interaction is known by its short abbreviation - IPC (Inter Process Communication), which combines various ways of exchanging messages and synchronizing data.
Consider an example of such an interaction. In Oracle BPM, inter-process communications are combined into such a concept as Conversation, with the help of which it determines the interaction scenario between the participants of communication. Moreover, as participants can be different components of the solution, such as BPMN or BPEL processes, Human Tasks, Business Rules, services external to the process.
')
There are different types of Conversation, which define the interface of “communication” of your process with other processes or services, it can be your own interface, or available by default. Detailed information on this can be found in the
relevant Oracle documentation . In our demonstration, we will limit ourselves to data exchange between two processes, so in our case we will use the default interface for inter-process communication:
1. The first process is the main one, it emulates the stages of processing the application;
2. The second process - auxiliary, emulates a request for additional information on the application, which may take some time and the results of the test may be needed by the main process not immediately, but at one of the stages of implementation.
As we see in this scenario, we need to organize parallel execution of 2 processes that interact with each other in the execution mode.
So, run JDeveloper and open the Samples application that you created in the
previous article . Repeat the steps to create it if you do not have it. Create a 2nd process that will emulate the operation of a certain background process that emulates the activity of checking data on an application:
1. Right-click on the “PubSubPr” project, select the “New” option and select the new BPMN 2.0 Process creation template from the gallery;
2. In the “Wizards” window that will open, specify the name “BackgroundProcess” as the name, specify “Asynchronous Service” as the process type (process with asynchronous interaction interface);
3. For the input argument of the process (Input), specify a variable with the name “reqProcess” as the type specify the QuoteRequest available from the xsd Quote scheme of the public example
Sales Quote Demo :

4. For the output argument of the process (Output), specify a variable with the name “checkResult” as the variable type, specify Boolean;
5. Click “Finish”, this is where the steps to create the process are completed, then we will create the necessary activities in it;
6. Create a process variable checkResult with type Boolean:

7. First of all, we emulate the execution of a certain long-term activity, for this we transfer to the process the activity “Timer” from the palette of the process components of the “Catch Events” section;
8. In the dialog box that opens, leave the name of the default activity and immediately go to the “Implementation” tab, here specify the waiting period equal to 1 min., As in the picture below:

9. Again, in order to emulate the results of performing some activity, transfer the Script activity from the component palette to the process diagram and leave the default name in the Wizards window that opens and go to the Implementation tab, initialize the process variable to true here using Data Associations:

10. In order for the process to return the expected value to the caller, we configure the mapping of the activity data of the “End” process:

This completes the creation of the auxiliary process. Now we will make the necessary changes to the main process and set up interaction with the auxiliary one. We will take the process - “Process” already existing in the project “PubSubPr” as the base of the main process and perform the following steps sequentially:
1. Change the start type of the process to “Message”, define a new interface for exchanging messages, and specify the quoteRequest variable with the “QuoteRequest” type as the argument and specify “start” as the name of the operation:

2. Set up the data mapping of the variable argument with the process variable:

3. Now create a so-called. “Conversation”, which we will later use to interact with the auxiliary process, in the structure of the process, right-click on the “Conversation” node and select “new”.
4. In the window that opens, assign the name “Process_BackgroundProcess” as the interaction type, specify “Process Call”, after which we have the opportunity to select the process to be called, select “BackgroundProcess”:

5. Transfer the activity of “ThrowEvent” to the process, which will call our auxiliary process and select “Process_BackgroundProcess” just created as “Conversation”, and “Start” as the called node:

After that we specify the data mapping:

6. Now transfer to the process the activity “CatchEvent”, having reached which the process will expect the result of the auxiliary process, specify “Process_BackgroundProcess” as the Conversation, specify “End” as the called node:

After the completed actions, copy the result of the process work into the checkResult process variable (if it is absent, create it):

7. Next, you need to slightly modify the process diagram itself to emulate actions in it, make the changes according to the diagram below (note that all activities in the process are marked as “drafts”; the corresponding activity flag, “Is Draft”, is responsible for this).

For the “conditional” branch leading to the ReviewTask task (highlighted in red), specify the transition condition:

As a result of the actions performed, we received a project ready for testing consisting of 2 interacting processes. Deploy it to the Weblogic application server integrated in JDeveloper. To do this, right-click on our project “PubSubPr” and select the option “Run”:

After our application is deployed on the weblogic server integrated into JDeveloper, we can begin testing. Open the Enterprise Manager system monitoring console at localhost: 7101 / em, open the deployed application, PubSubPr, and select the Process.service web service for testing:

Then check the history of the running process instances:

Check the execution history of the completed process instance:

Here you can see that at the moment of passing the token of the “ThrowEvent” activity process (in our case, the execution time of the activity is “13:50:14”), the “BackgroundProcess” process was called asynchronously (the start time is “13:50:15”):

Then, after completing a few steps, our main process “Process” waited 1 minute until “BackgroundProcess” returns the response in the activity “CatchEvent”, after which it continued its execution.
We can also visually see the process interaction diagram at the process design stage in JDeveloper. It is available in the BPMN diagram of our main process model on the “Collaboration” tab:
