Class MessagingService

  • All Implemented Interfaces:
    jade.core.messaging.MessageManager.Channel, Service
    Direct Known Subclasses:
    MomMessagingService

    public class MessagingService
    extends BaseService
    implements jade.core.messaging.MessageManager.Channel
    The JADE service to manage the message passing subsystem installed on the platform.
    Author:
    Giovanni Rimassa - FRAMeTech s.r.l., Nicolas Lhuillier - Motorola Labs, Jerome Picault - Motorola Labs
    • Constructor Detail

      • MessagingService

        public MessagingService()
    • Method Detail

      • init

        public void init​(AgentContainer ac,
                         Profile p)
                  throws ProfileException
        Performs the passive initialization step of the service. This method is called before activating the service. Its role should be simply the one of a constructor, setting up the internal data as needed. Service implementations should not use the Service Manager and Service Finder facilities from within this method. A distributed initialization protocol, if needed, should be exectuted within the boot() method.
        Specified by:
        init in interface Service
        Overrides:
        init in class BaseService
        Parameters:
        ac - The agent container this service is activated on.
        p - The configuration profile for this service.
        Throws:
        ProfileException - If the given profile is not valid.
      • boot

        public void boot​(Profile myProfile)
                  throws ServiceException
        Performs the active initialization step of a kernel-level service: Activates the ACL codecs and MTPs as specified in the given Profile instance.
        Specified by:
        boot in interface Service
        Overrides:
        boot in class BaseService
        Parameters:
        myProfile - The Profile instance containing the list of ACL codecs and MTPs to activate on this node.
        Throws:
        ServiceException - If a problem occurs during service initialization.
      • shutdown

        public void shutdown()
        Description copied from interface: Service
        Performs the shutdown step of a kernel-level service. The JADE kernel calls this method just before uninstalling this service
        Specified by:
        shutdown in interface Service
        Overrides:
        shutdown in class BaseService
      • getName

        public String getName()
        Retrieve the name of this service, that can be used to look up its slices in the Service Finder.
        Specified by:
        getName in interface Service
        Returns:
        The name of this service.
        See Also:
        ServiceFinder
      • getHorizontalInterface

        public Class<?> getHorizontalInterface()
        Retrieve the interface through which the different service slices will communicate, that is, the service Horizontal Interface.
        Specified by:
        getHorizontalInterface in interface Service
        Overrides:
        getHorizontalInterface in class BaseService
        Returns:
        A Class object, representing the interface that is implemented by the slices of this service.
      • newAlias

        public void newAlias​(AID alias,
                             AID agent)
      • deadAlias

        public void deadAlias​(AID alias)
      • removeGlobalAliases

        public void removeGlobalAliases​(AID agent)
      • getLocalSlice

        public Service.Slice getLocalSlice()
        Retrieve the locally installed slice of this service.
        Specified by:
        getLocalSlice in interface Service
        Overrides:
        getLocalSlice in class BaseService
        Returns:
        The slice of this service that resides on the local platform node, or null if no such slice exists.
      • getCommandFilter

        public Filter getCommandFilter​(boolean direction)
        Access the command filter this service needs to perform its tasks. This filter will be installed within the local command processing engine.
        Specified by:
        getCommandFilter in interface Service
        Overrides:
        getCommandFilter in class BaseService
        Parameters:
        direction - One of the two constants Filter.INCOMING and Filter.OUTGOING, distinguishing between the two filter chains managed by the command processor.
        Returns:
        A Filter object, used by this service to intercept and process kernel-level commands.
        See Also:
        CommandProcessor
      • getCommandSink

        public Sink getCommandSink​(boolean side)
        Access the command sink this service uses to handle its own vertical commands.
        Specified by:
        getCommandSink in interface Service
        Overrides:
        getCommandSink in class BaseService
        Parameters:
        side - One of the two constants Sink.COMMAND_SOURCE or Sink.COMMAND_TARGET, to state whether this sink will handle locally issued commands or commands incoming from remote nodes.
        Returns:
        Concrete services must return their own implementation of the Sink interface, that will be invoked by the kernel in order to consume any incoming vertical command owned by this service. If the service does not wish to install a command sink, it can just return null.
        See Also:
        Service.getOwnedCommands()
      • getOwnedCommands

        public String[] getOwnedCommands()
        Access the names of the vertical commands this service wants to handle as their final destination. This set must not overlap with the owned commands set of any previously installed service, or an exception will be raised and service activation will fail.
        Specified by:
        getOwnedCommands in interface Service
        Overrides:
        getOwnedCommands in class BaseService
        Returns:
        An array containing the names of all the vertical commands this service wants to own. If this service has no such commands (it acts purely as a command filter), it can return an empty array, or null as well.
        See Also:
        jade.core.Service#getCommandSink()
      • deliverNow

        public void deliverNow​(GenericMessage msg,
                               AID receiverID)
        Specified by:
        deliverNow in interface jade.core.messaging.MessageManager.Channel
      • notifyFailureToSender

        public void notifyFailureToSender​(GenericMessage msg,
                                          AID receiver,
                                          InternalError ie)
        This method is used internally by the platform in order to notify the sender of a message that a failure was reported by the Message Transport Service.
        Specified by:
        notifyFailureToSender in interface jade.core.messaging.MessageManager.Channel
      • getMessageManagerQueueStatus

        public String[] getMessageManagerQueueStatus()
      • getMessageManagerThreadPoolStatus

        public String[] getMessageManagerThreadPoolStatus()
      • getMessageManagerGlobalInfo

        public String getMessageManagerGlobalInfo()
      • getMessageManagerThreadPool

        public Thread[] getMessageManagerThreadPool()
      • dump

        public String dump​(String key)
        Description copied from class: BaseService
        This method can be redefined to support service internal data inspection by means of the ContainerMonitorAgent included in the misc add-on. The default implementation just dumps the map of cached slices
        Overrides:
        dump in class BaseService
        Parameters:
        key - A hint indicating which service data should be dumped
        Returns:
        A string representation of the service internal data