Package astra.lang

Class Messaging


  • public class Messaging
    extends Module
    This class implements support for the management of ASTRA's lightweight messaging infrastructure.

    The methods provided in this class deliver basic functionality to manage ASTRAs messaging infrastructure. This infrastructure is lightweight in that, it does not require extensive configuration.

    When deploying a message service, the standard usage of the methods in this class is as follows:

    1. Install the message service
    2. Configure the service by setting properties
    3. Start the service

    This deployment is typically done as one of the first tasks by a "main" agent so that other agents can communicate using the infrastructure.

    The ASTRA equivalent of this is:

    rule +!main(list args) {
    messaging.installService("local", "astra.messaging.LocalMQService");
    messaging.startService();
    }
    Author:
    Rem Collier
    • Constructor Detail

      • Messaging

        public Messaging()
    • Method Detail

      • installService

        public boolean installService​(String id,
                                      String clazz)
        Action that installs a Message Service.

        This method installs a message service in to the local JVM. Message services route messages to agents on the local platform or via a remote connection to another platform.

        All message services must implement the astra.messaging.MessageService interface.

        Parameters:
        id - a unique identifier by which the service can be referenced
        clazz - the canonical name of the class that implements the service
        Returns:
        true if the action succeeds, false otherwise
        See Also:
        MessageService
      • setProperty

        public boolean setProperty​(String id,
                                   String key,
                                   String value)
        Action that sets a property for a message service.

        This method allows you to configure a message service by setting a property of that service

        Parameters:
        id - the id of the service
        key - the key of the property
        value - the value of the property
        Returns:
        true if the action succeeds, false otherwise
      • startService

        public boolean startService​(String id)
        Action that starts the message service.
        Parameters:
        id - the id of the service.
        Returns:
        true if the action succeeds, false otherwise