Sometimes you may want your port to have a queue storing incoming messages. It is frequently needed, when messages are processed not just on arrival, but later on. Such sort of a port queue can be easily implemented using AnyLogic collection, which acts as a container for incoming messages.
make a port store incoming messages
messages.add( msg );
Note that returning false we prohibit the default processing of the message. Thus received messages will not be forwarded further according to the message routing rules. If you need to send it further, type return true; instead.
Incoming messages will be placed into our "port queue". You can work with the queue contents using standard Collection API.