Receive
BPMN Implementation: Receive task, Message catch event
When a BPEL processing engine gets a message, it searches for a receive (or pick) activity with a matching partner link and operation. For an executable process, the receive must specify an input variable or variable part for the message data received. See
Partner Link for descriptions of concepts important to this activity.
The receive activity can begin a business process instance by including a Create Instance property set to Yes. A receive activity can be associated with a reply activity if the operation is a request-response. Additionally, the receive can include a message exchange attribute.
You can create a set of concurrent initial receives. This case allows for any one message of a set to initialize a BPEL process. To create a multiple-activity starting point, add the receives to a flow container. Also, you must provide a correlation set for all concurrent receives that initiate a process, as described in
Adding Correlations to an Activity.
Two other activities are similar to a receive: an onMessage clause in a pick activity or and onEvent event handler. For more information, refer to
Pick and
Event Handling.
To add a receive activity to the process manually:
- 1. Drag a Receive task or Message catch event activity to the Process Editor canvas.
You can add a background color to the receive task, but not the message catch event.
- 2. In the Properties view, select the following values:
- a. Optionally type in a Name.
- b. In the Participant drop-down, select New Process Service Consumer. See Creating a New Partner Service Interface.
- c. Select an Operation from the picklist.
- 3. In the Data tab, do one of the following:
- - Select Single Variable from the Assignment Type and create a new variable or select a process variable.
- - Create a Parts to Variables specification. For details, see From Part to Variable.
- - Create an XPaths specification. For details, see Input Variable.
- 4. Select other optional properties as desired.
A receive activity is actually two activities: a Receive followed by an Assign in a Scope. These two activities are not atomic and if you, for example, initialize onAlarm in an event handler, you cannot use the variable until the assign has completed.
Usage Examples
One receive can start a process | In a pick (event-driven gateway) with onMessage activities, one of many can start a process; the rest are ignored | Any one starts a process; all are required to complete the fork join (flow ) |
XML Syntax
<receive partnerLink="NCName" portType="QName"?
operation="NCName"
variable="BPELVariableName"? createInstance="yes|no"?
messageExchange="NCName"?
standard-attributes>
standard-elements
<correlations>?
<correlation set="NCName" initiate="yes|join|no"?>+
</correlations>
<fromParts>?
<fromPart part="NCName" toVariable="BPELVariableName"/>+
</fromParts>
</receive>
XML Example:
<receive name="ReceiveCustomerRequest"
partnerLink="customer"
portType="lns:loanServicePT"
operation="request"
variable="request"
createInstance="yes"/>