Receiving Messages

To react to a received message, you can choose one of the ways described below. 

Defining message reception handler

You can define the message reception handler in the On Receive property of the port. This code is executed each time a message is received. In that code you can use a local variable msg, which is a reference to a just received message. The code may contain return statement returning true or false. If true is returned, the message is forwarded further as defined by message routing rules. The same happens by default when On Receive is left blank. If false is returned or if you write any code and return nothing, the default processing is omitted – i.e., the received message is not forwarded further.

Generating events for a statechart

You can forward the received message to a statechart. Then all messages accepted by the port are placed into the statechart queue as message events. 


Related topics

 Message passing

 Messages

 Sending messages

 Message routing rules