Reactive Message Agent
From Agent Factory
Contents |
Editorial History
08/07/2008: Version 1 - Initial version of page
Introduction
In addition to the deliberative agent architectures that underpin the AFAPL, AFAPL2 and ALPHA agent oriented programming languages, Agent Factory also supports the creation of reactive agents via the Reactive Message Agent (RMA) architecture. This architecture is based on the simple example architecture that is presented as part of the Architecture / Interpreter Development Guide, and is used to implement the Robust FIPA Architecture infrastructure.
The text below outlines the overall structure of the RMA Agent Architecture. For information on how to create agents using this architecture, please see the RMA Programmers Guide.
Overview of Architecture
The architecture is intended to support the fabrication of reactive agents. Specifically, it supports handling of:
- Messages received from other agents that are handled by a MessageHandler; and
- Events received from internal components that are handled by an EventHandler.
As is shown in the schematic below, these are augmented with a simple map-based memory is provided to allow information to persist and be shared across different message and event handlers.
In this architecture, the RMA Agent monitors an internal inbox (implemented by a core component of ALL agents known as the FIPAMessageQueue) for new messages. On receipt of a new message, the currently loaded message handlers are checked until either an appropriate message handler is located or there is no suitable message handler (in this latter case, the agent sends back a not-understood message). If an appropriate message handler is located, then it is invoked.
The message handler is able to do some combination of the following:
- generate an appropriate response message
- generate an internal event, which is passed to the agents event queue
- perform operations on platform services
- interact with some other component that is external to the core agent architecture
- access or update the agents shared memory
In addition to handling incoming messages, the agent also handles events that are added to the event queue. These events may be generated by either a message handler or some other external (to the architecture) component. These events are processed in the same way as messages: a filter is used to check the relevant of each loaded event handler to the event, and each event handler is checked until either no suitable event handler is found (in which case, the event is ignored), or an event handler is found and executed. The event handler may do any combination of the operations identified for message handlers.
In contrast with languages such as AFAPL, RMA-style agents are purely Java entities and are created by extending the com.agentfactory.rma.ReactiveMessageAgent class which is provided as part of the RMA Development Kit, instances of the resultant agent implementations are then created by specifying relevant Java class as is discussed in both the Architecture / Interpreter Development Guide and the Application Deployment Guide.
Message Handlers
Message handlers are used to react to messages that are received from other agents. Logically, a message handler consists of two parts:
- A filter part that checks whether the handler should be used to handle a given message, and
- A handler part that specifies what the agent should do if the filter determines that a given message is relevant to the handler.
Message handlers are implemented by subclassing the com.agentfactory.rma.MessageHandler class.
Event Handlers
Similarly, event handlers are used to react to events that are generated by non-agent components that are linked to an agent. Logically, an event handler consists of two parts:
- A filter part that checks whether the handler should be used to handle a given event, and
- A handler part that specifies what the agent should do if the filter determines that a given event is relevant to the handler.
Event handlers are implemented by sub-classing the com.agentfactory.rma.EventHandler class.
Shared Memory
The RMA Agent provides a shared memory that can be used to persist and share information between handlers. This memory takes the form of a map that associates keys with objects, allowing data to be stored in any appropriate format.
Platform Services
The RMA Agent supports binding to and unbinding from platform services via associated methods bindToService(...) and unbindFromService(...) that are inherited from the generic agent class com.agentfactory.platform.core.Agent.

