To send a message, you should simply call the method send() of a port, providing the instance of a message class as a parameter. Defining your own message classes is described in section. If you need to just signal an object, you can send an instance of class Object that does not carry any data by calling the method send() with omitted parameter.
For example, you can type the following line of code in the Startup Code code section of an agent to send a message of Message type via its portA port at the model startup.
portA.send( new Message() );
You can define the message sending handler in the On Send property of the port. This code is executed each time a message is sent. In that code you can use a local variable msg, which is a reference of type Object to a just sent message. If true is returned, the message is processed further as defined by message sending rules. The same happens by default when On Send is left blank. If false is returned or if you write any code and return nothing, the default processing is omitted.
Message routing rules