Click OK. Handling Exceptions in Subprocesses

Communicating With Other BPMN Processes and Services 20-3 ■ Invoke an asynchronous BPMN process. ■ Define an interface for other processes to communicate with your process. The implementation of the different message events varies according to the type of event and their role in the conversation. Table 20–1 describes the different implementation of message events. Note: The send and receive tasks perform similar functionality to the throw and catch message events. However, it is recommended that you do not mix both within a single process. Table 20–1 Message Event Implementation Event Initiates Conversation Continues Conversation Message Start ■ Define the interface of the operation ■ Use an interface from the business catalog Not Available Message Throw ■ Invoke a Service ■ Invoke a BPMN Process If it continues a start event or a catch event that define an interface: ■ Define the callback interface for an asynchronous operation ■ Define the output for a synchronous operation ■ Define an exception for a synchronous operation If it continues a message throw that invokes a service or a BPMN process: ■ Invoke an operation from the same service or BPMN process it continues. Message Catch ■ Define the interface of the operation ■ Use an interface from the business catalog If it continues a start event or a catch event that define an interface: ■ Use the interface of the initiator event ■ Define the interface of the operation If it continues a throw event that invokes a service or a BPMN process: ■ Invoke the callback of the service or the BPMN process Message End Not Available If it continues a start event or a catch event that define an interface: ■ Define callback for an asynchronous operation ■ Define the output for a synchronous operation ■ Define an exception for a synchronous operation If it continues a throw event that invokes a service or a BPMN process: ■ Invoke an operation from the same service or BPMN process it continues. 20-4 Modeling and Implementation Guide for Oracle Business Process Management

20.3 Using Message Events to Invoke Asynchronous Services and Asynchronous BPMN Processes

You can use message events to invoke asynchronous services and asynchronous BPMN processes. To invoke an asynchronous operation from service or BPMN process you must use an intermediate throw message event configured to initiate a conversation. When the BPMN Service Engine runs the message throw event, it creates an XML message based on: ■ the asynchronous operation ■ the input required by the asynchronous operation ■ the data association defined for the message throw event Then it sends the XML message to the service or BPMN process, and continues running the rest of the process flow. It does not wait for the asynchronous service or BPM process to answer. The asynchronous service or BPMN process receives the message and runs the requested operation. When it finishes it sends a message with the result of the operation to the BPMN process that invoked it. This message is the callback operation of the asynchronous service or BPMN process. The BPMN process that invoked the asynchronous operation must wait for the callback operation to obtain its results. The BPMN process must define a message catch event that waits for the callback operation. This message catch event continues the conversation and uses the message throw event that invoked the operation as the initiator event. When a token arrives to the message catch event it might receive an immediate answer if the asynchronous process completed, or might have to wait until the asynchronous process completes to get an answer. Figure 20–1 Invoking an Asynchronous Service or BPMN Process Using Message Events This figure shows a BPMN process that invokes an asynchronous operation defined in an external service or in another BPMN process. This BPMN process uses message events to invoke the asynchronous operation.

20.3.1 How to Invoke Asynchronous Service Operation Using Message Events

You can invoke an asynchronous service operation using message events. Communicating With Other BPMN Processes and Services 20-5 To invoke an asynchronous service operation using message events: 1. Edit the BPM process where you want to invoke the asynchronous service operation. 2. Locate the point in your process where you want to invoke the asynchronous service operation. 3. Add a message throw event in the point you located in your process. 4. Right-click the message throw event.

5. Select Properties.

6. Click the Implementation tab.

7. In the Conversation section, select Initiates.

8. In the Properties section, select Service Call from the Implementation list.

You must ensure that the service you select is an asynchronous service.

9. Click the Browse button next to the Name field.

The Type dialog appears. 10. Select the asynchronous service you want to invoke.

11. Click OK.

12. From the Operation list, select the operation to invoke from the asynchronous service. 13. If the asynchronous service requires arguments, configure the message throw event data association. See Section 8.13, Introduction to Data Associations , for more information on how to configure data associations.

14. Click OK.

15. Follow the procedure described in Section 20.3.2, How to Receive the Callback Operation of an Asynchronous Service Using Message Events to invoke the callback operation of the asynchronous process.

20.3.2 How to Receive the Callback Operation of an Asynchronous Service Using Message Events

You can receive the callback operation that pairs with an asynchronous operation using message events. To receive the callback operation of an asynchronous service using message events: 1. Edit the BPM process where you want to receive the callback of the asynchronous service. 2. Locate the point in your process where you want to receive the callback operation of the asynchronous service. 3. Add a message catch event in the point you located in your process. 4. Right-click the message catch event.

5. Select Properties.

6. Click the Implementation tab.