You can include an intermediate message event
in your business process definition (BPD) when you want to model a
message event that is received during execution of a process. When
the process execution reaches an intermediate message event, if a
matching message is stored in the system, it is passed to the message
event, otherwise, further execution along that path is blocked until
an incoming message arrives that matches.
Intermediate message events can be attached to activities
within your BPDs or they can be included in the process flow, which
is connected with sequence flows. Drag an intermediate message event
onto the swimlane to create an intermediate message event. If you
drag an intermediate message event onto an activity, it becomes a
boundary message event. You can change either existing message event
type to the other type by dragging it to or from the swimlane or activity.Tip: When you add message events in a BPD, be aware of the general
information in
Modeling message events that
applies to all types of message events.
Before you begin
To perform this task, you must be in the IBM® Process
Designer desktop
editor.
About this task
For a receiving intermediate message event, you can use
an undercover agent (UCA) for the message triggering mechanism.
You can also use a Service Component Architecture
(SCA) service as the triggering mechanism.
Tip: To
build a sample inbound integration that includes an intermediate message
event included in the process flow, which is connected with sequence
lines, see
Building a sample inbound integration.
Procedure
- Open the Process Designer desktop editor.
- Open a BPD and drag an Intermediate Message
Event component from the palette onto the BPD diagram. It can be dragged
to the swimlane or attached to an activity. When the event
is attached to an activity, the event is known as a boundary event
and it is included in the outline of the activity.
- On the Properties tab, click Implementation.
- Select the event type Message.
- If you dragged the Intermediate Message Event component
onto the BPD diagram, in the Intermediate Event Details section,
select the intermediate event type Message.
- If you dragged the Intermediate Message Event component
onto an activity, in the Boundary Event Details section,
select the intermediate event type Message.
- If the intermediate message event is
a boundary event, use the Boundary Event Details section
to specify its behavior:
- If receiving the message signals completion
of the activity, make sure that the Interrupt Activity option
is selected, which is the default setting. Otherwise, clear the selection,
so that the activity is not interrupted and completed when the message
is received.
- If Interrupt Activity is
not selected, the Repeatable option is available.
If the boundary message event can be triggered more than once, select
the Repeatable option so that the attached
activity can receive multiple messages.
- To use a UCA for triggering an intermediate message event,
complete the following actions in the Message Trigger section.
- For Triggering Mechanism, select UCA.
- To select an existing undercover agent, click Select next
to the Attached Message UCA field.
- To create an undercover agent, click New.
See Undercover agents.
- In the Condition text box, type
a JavaScript expression if you want to define conditions under which
the message event is processed.
If you do specify a
condition and the condition evaluates to true, the message is accepted
and processing continues. If the condition evaluates to false, processing
stops. In most cases, special message conditions are not necessary
because you should implement each message event with a separate undercover
agent.
- If you want the incoming message to be consumed after
it is received by the message event, enable Consume Message.
Refer to the bulleted list in Modeling message events to
learn more about message consumption.
- To allow the message event to receive an incoming message
that arrives before a process is at a point where the event can accept
the message,
select Durable Subscription. The durable subscription
causes the message to be stored until the message event is reached.
Only the most recently received message is stored.
Tip: If you occasionally use inbound messages and undercover
agents, consider using durable subscription events.
When Durable
Subscription is selected, incoming messages are persisted
in the database. The durable messages accumulate, even if you select
the check box to make them consumable. Periodically use the BPMDeleteDurableMessages
command for deleting durable subscription events.
Important: The sender and receiver of the message
must both use the same undercover agent. For example, if the sender
of the message is a message end event in another BPD, then select
the same undercover agent for both the receiving intermediate event
and the sending message end event in the other BPD.
Tip: Undercover agents must have a schedule type of On
Event to function as a message trigger. Plus, the service
that is attached to the selected undercover agent must have one or
more input variables so that it can pass and correlate information
from the event.
- To use an SCA service for triggering an intermediate message
event, complete the following actions in the Message Trigger section.
- For Triggering Mechanism, select SCA
Service.
- For Message Object Type, click Select to
select a business object (BO) type, click New to
define a new BO type, or leave it to be set automatically when you
select a service definition. The business object type
that you select determines the output parameters of the intermediate
message event. The message object type must be a complex type.
- For Service Identifier, a default
value is provided, based on the name of the event, as shown in the
BPD diagram. If you want, you can either specify a different
service identifier name, or select one from the drop-down list of
services that match the selected message object type. If you enter
a name, it is restricted to using the NMToken character set.
- If you selected an existing service definition and the message
object type was not set, the message object type is updated to match
the service definition.
- The service identifier is used with the BPD name to generate a
unique SCA service for this event point. The generated service interface
name is displayed.
- If you selected an existing service definition, the associated
events are added to the list of events that the definition includes.
- If
you specify the same SCA identifier for multiple message events, any
changes to the service identifier or message object type affect all
the events that provide the service. Making such changes can break
data mappings for the events.
- To restore the default value, click the X (delete)
icon.
Tip: If
you specify the same SCA identifier for multiple message events, the
service interface can trigger multiple events in the BPD. However,
each incoming message is received by only one of the events. Which
event receives the message, or whether it is stored for future delivery,
depends on whether a correlating process instance is found, and if
so, which compatible message events are in the waiting state. For
details of the semantics, see Using Service Component Architecture to interact with processes.
Important: It
is possible to define unintentionally the same service identifier
on multiple events. For example, if different events have identical
names (which is shown as an error on the General tab), or if different
service identifiers map onto identical NMToken strings. If such a
naming clash happens, you can break the unintended polymorphism by
renaming the duplicate event names and then click X (delete)
to restore the default service identifier name.
- Specify the correlation and output mapping.
- On the Properties tab, click Data
Mapping.
- Open the Correlation and Output Mapping section.
- Select the output variable that you want to use to for
correlation. The value that is assigned to it ensures that the parameter
values of the runtime message are passed to the correct BPD instance.
The variable that is selected for correlation is identified by an
assignment symbol (). This correlation
ensures that the parameter values of the runtime message are passed
to the correct BPD instance.
- For undercover agents that are implemented using a complex variable
rather than a service, you can select the complex variable or the
top-level child properties of the variable for mapping or correlation.
- If you use SCA, you must select a variable
that is marked as a process instance identifier that ensures that
the message is passed to the correct BPD instance based on the value
of that variable.
- Map each output variable to a local variable in the
BPD. For each variable, click the variable selector icon
to map each output variable to a local variable in the BPD.