Package jade.core

Class TemplateBasedMessageQueue

  • All Implemented Interfaces:
    MessageQueue

    public class TemplateBasedMessageQueue
    extends ExtendedMessageQueue
    Enhanced version of the agent MessageQueue that supports creating dedicated queues of messages to explicitly registered MessageTemplates.
    Author:
    Caire
    See Also:
    registerTemplate(), Agent.createMessageQueue()
    • Constructor Detail

      • TemplateBasedMessageQueue

        public TemplateBasedMessageQueue​(int maxSize,
                                         int warningLimit,
                                         MessageTemplate warningDiscardTemplate,
                                         Agent a)
      • TemplateBasedMessageQueue

        public TemplateBasedMessageQueue()
    • Method Detail

      • registerTemplate

        public void registerTemplate​(MessageTemplate tpl)
        Register a specific MessageTemplate to this MessageQueue. All incoming messages matching this template will be inserted into a dedicated queue and calls to receive() with the registered template as parameter will extract messages from the dedicated queue only. In situations with heavy load of messages (several messages in the agent queue), this can speed-up performances of the receive() method a lot. If an incoming message matches more than one registered template it is inserted in the queue associated to the first matching template.
        Parameters:
        tpl - The MessageTemplate to be registered