Home > Process Behavior Procedures and Reference > Process Behavior Reference > Example: Message Exchange Between Two Activities

Example: Message Exchange Between Two Activities

The following example defines a message sent between activities in two related processes or within a process. The message line from the Book Dealer process to the Bookstore1 process is a visual indicator and does not affect the simulation.

Note that in this example, we do not show details of the “Give Bookstore1 Quote” or “Bookstore1 Accept Order” processes in the Bookstore1 partner (or the corresponding processes in the Bookstore2 partner.) These processes are represented, and their behavior modeled, by single activities for the purposes of simulation. In this example, we are primarily interested in exploring the behavior of the Book Dealer partner.

messagesimulationdiagram.bmp 

  1. If you were to double-click the Get Bookstore1 Quote activity in the Book Dealer process, you could view its properties shown below. The On Completion properties of this task specify the message Bookstore1GetPrice message is to convey data between this activity and an activity in another pool. Note that the messaging partner is Bookstore1. For information on partners, see BPMN Terminology Reference.

    taskoncompletion_getbookstore1quote.bmp 

  2. If you were to double-click Give Bookstore1 Quote activity in the Bookstore1 process, you could view its properties shown below. The On Completion properties are the same as on the Get Bookstore1 Quote activity, except that now Book Dealer is listed as a messaging partner. This is the return value for the Bookstore1GetPrice message. If you were to click the Message icon, you would see that the message is defined to send the ISBN number of the book, and expects to receive the price of that book in reply. See step 4 below for more information about the message definition for both activities.

    The Inputs page shown in step 3 represents the receiving of the message. It is not necessary to both receive and reply to a message in the same activity. After a process receives a message that expects return data and before the process has replied, the simulator treats any send of that message from the process to the partner that initiated the earlier message of the same name as the reply.

    taskoncompletion_givebookstore1quote.bmp 

  3. In this example, a new transaction is generated in the Bookstore1 partner process when it receives the message, so we choose Introduce Transactions Using this Shape. A generator icon is placed on the shape to indicate that this is a starting point for transactions in the process. If the transaction already existed and was being synchronized by the incoming message, such as a CancelOrder message, you would choose None from the Introduce Transactions drop-down list.

    inputsusingthisshape_bookstore1.bmp 

  4. The Define Messages dialog box appears when you click the Create/Modify Messages messagebutton.bmp button.

    definemessagessim.bmp 


In the Bookstore1GetPrice message definition used on both activities in both processes, the Send data is the ISBN, which is sent from the Get Bookstore1 Quote activity in the Book Dealer process to the current activity. The Receive data is the Bookstore1Price. Send and receive data parameters are message attributes. For more information, see Define Messages dialog box.

The terms Send and Receive are used from the perspective of the client initiating the message, so from the perspective of the Bookstore1 partner servicing the message, it receives the ISBN number, and must send the price back using the same message. The information on the On Completion task of the shape that sends the message back represents the response carrying the price back to the client.

This simulation continues by collecting the data returned from the two separate price quotes by combining the two separate paths with a join, then sending the transaction to a decision step where the lowest book price is determined. The Book Dealer process completes by sending a book order to the vendor with the lowest price.

Related Topics

Define Tasks