Class Messaging
- java.lang.Object
-
- astra.core.Module
-
- astra.lang.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:
- Install the message service
- Configure the service by setting properties
- 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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class astra.core.Module
Module.ACTION, Module.EVENT, Module.FORMULA, Module.SENSOR, Module.SUPPRESS_NOTIFICATIONS, Module.TERM
-
-
Constructor Summary
Constructors Constructor Description Messaging()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleaninstallService(String id, String clazz)Action that installs a Message Service.booleansetProperty(String id, String key, String value)Action that sets a property for a message service.booleanstartService(String id)Action that starts the message service.
-
-
-
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 referencedclazz- 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 servicekey- the key of the propertyvalue- 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
-
-