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

Communicating With Other BPMN Processes and Services 20-11

20.6 Communicating With Other BPMN Processes and Services Using Send and Receive Tasks

Send and receive tasks enable you to communicate with the other BPMN processes and services in your project. The only difference between message events and send and receive tasks is that you can add boundary events to the latter. If you are invoking an asynchronous service and you want to add a deadline using a timer event configured as boundary, then you must use a send and a receive task instead of using message events. You can use send and receive tasks to: ■ Invoke an asynchronous service. ■ Invoke an asynchronous BPMN process. ■ Define an interface for other processes to communicate with your process. To use a receive task to define the start operation of a process, you must locate it after a none start event and configure it to create instances. 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.

20.7 Using Send and Receive Tasks to Invoke Asynchronous Services and Asynchronous BPMN Processes

You can use send and receive tasks to invoke asynchronous operations in services and BPMN processes. 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–2 Send and Receive Tasks Implementation Task Initiates Conversation Continues Conversation Send Task ■ Invoke a Service ■ Invoke a BPMN Process If it continues a receive task that defines an interface: ■ Define the callback interface for an asynchronous operation ■ Define the output for a synchronous operation ■ Define an exception for a synchronous operation Receive Task ■ Define the interface of the operation ■ Use an interface from the business catalog If it continues a receive task that defines an interface: ■ Use the interface of the receive task it continues ■ Define the interface of the operation If it continues a sent task that invokes a service or a BPMN process: ■ Invoke the callback of the service or the BPMN process 20-12 Modeling and Implementation Guide for Oracle Business Process Management To invoke an asynchronous operation from service or BPMN process you must use a send task configured to initiate a conversation. When the BPMN Service Engine runs the send task, 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 invoke the callback operation to obtain its results. When it invokes the callback operation it might receive and immediate answer if the asynchronous process completed or might have to wait until the asynchronous process completes to get an answer. Figure 20–3 Invoking an asynchronous service or BPMN process using send and receive tasks 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 send and receive task to invoke the asynchronous operation

20.7.1 How to Use a Send Task to Invoke an Asynchronous Service Operation

You can invoke an asynchronous service operation using a send task. To invoke an asynchronous service operation using the send task: 1. Edit the BPM process where you want to invoke the asynchronous service. 2. Locate the point in your process where you want to invoke the asynchronous service. 3. Add a send task in the point you located in your process. 4. Right-click the send task.

5. Select Properties.