How to Throw an Exception

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.