Message Routing Rules
When you send a message via a port, it is forwarded along all port connections outside the agent this port belongs to.
When a message is received at a port, it is forwarded to all connected statecharts and along all port connections inside the agent this port belongs to.
When a message arrives at a port, it is processed depending on the direction the
message is going.
- If a message arrives to a port of an object from a port of its embedded object, it is
sent from this port further along the external connections of the port. In this case the
method send() of the port is
called and the code specified in the On
send property of the port is executed.
- Otherwise, if a message arrives to a port from the outside, the message is
received by a port and is forwarded along all port connections inside the agent this port belongs to. The method receive() of
the port is called and the code specified in the port On receive property is executed.
When a message arrives at a statechart, it is received by the statechart and the method receiveMessage() of the statechart is called.
The message routing rules are illustrated on the figure below:

Related topics
Message passing
Messages
Sending messages
Receiving messages