Modeling a send message event
Processes can use Intermediate message events to send and receive messages to and from each other. This can be used to make one process trigger another process to start or for one process to trigger another process to continue if it has been paused.
On Barium Live you can model and configure message events to send and to receive messages by using the Intermediate Event in your process models.
Below is a common example of modeling one process that sends a message to another process.
You must also create a process model that will receive your message and trigger something. For example a process like the process model below.
Apart from the modeling your processes in this way you also need to configure them to work as a process application.
Configuring a send message event
Sending messages between processes is known as sending and receiving "Named Messages".
1. Create a process application like the first one above.
You must have two (2) pools.
An intermediate event of the type "Message" in the pool you want to send a message from.
A message flow from the message event to the pool you want to send a message to.
2. Right-click on the message event and click on Properties.
3. First, you must choose which Implementation to use. Make sure you choose NamedMessage.
NamedMessage is what is used to send messages between processes on Barium Live. Other implementations can be used if you want to send a message to some other kind of service.
4. Expand the section called MessageRef by clicking on the plus next to it.
5. Click on the MessageDirection and choose Send (if it is not already chosen).
6. To send data directly to an application (for example filling fields in a form with data from the first application, see THIS article.
7. In the property Name you specify what message you want to send. You can write any message you want, just make sure that in your receiving process you write the same Name to receive the message and trigger the process (More on receiving messages later on). For now write myMessage in the Name property. Remember that names are case-sensitive.
8. You must also configure which process you want to send a message to. You do this by modeling a pool into the process that will send a message. Right-click on the pool header and click on Properties.
9. At the bottom of the properties tab there is a property called ProcessApplication. Here you indicate which process application the pool represents. Your message will be sent to whichever process application you choose from the list. Choose the process application that you want to receive the message being sent. In this case one called Receive Named Message.
Once you've chosen your process application the value in the property will be the ID of the application and not the name you have chosen. This is normal.
Configuring a receive message event
Receiving a message can be done using a message event. When a process sends a message to another process configured to receive that specific message it can be triggered to start or continue depending on whether it's a start event or an intermediate event.
In this case the process to receive a message is modeled to have a message trigger configured on its start event.
1. Right click on the start event and click on Properties.
2. Just like in the process for sending a message you must configure the messageStartEvent properties to receive a specific message. For the property Implementation choose NamedMessage.
3. Expand MessageRef to get access to the MessageDirection property. The start event is supposed to receive a message, so set the direction to Receive.
4. You message Name has to have the same value as the message you send. Remember that it's case sensitive. In this example the name in the process Send Named Message sends myMessage so you have to write the same value in the start events name property.
5. Make sure that you publish your process models and upgrade the process applications to the latest version of the process models. For testing purposes make sure that you put your own account on all participant roles in the two process applications.
Sending field data from one application to another
You can also bring data from form fields in the sending process to form fields in the receiving one. For configuration, do the following:
1. Follow the steps above.
2. In the Properties field, click the Collection button:
3. In the window that appears, click Add.
4. In the field called Name enter the name of the field in the receiving process. Note that it's the form that is used to start the instance (connected to the start event) that will receive the field data. In the field Value you define the form and field from which the data will be fetched. By using the format shown above you define that you want to send data from the field called "sendingField2" in the form "form": $form.sendingField2$.
Under Run > Start new instance (in the space of your choice) you should see your process Send Named Message and the event start.
Start the process just like you would normally and run the process. Once your token comes to the intermediate event in the Send Named Message process a message will be sent to the process application Receive Named Message and it will be triggered to start. You should have a task in your inbox for the process application Receive Name Message. Note that it can take a couple of minutes before the message triggers the start event, for security reasons there is a delay on Barium Live when sending messages.