The
AgentServer
class manages the global configuration of an agent server. It reads the configuration file, then it creates and configure {@link Engine
Engine
}, {@link Channel
Channel
}, {@link Network
Network
s}. This class contains the main method for AgentServer, for example to activate a server you have to run this class with two parameters: the server id. and the path of the root of persistency. You can also use a specialized main calling methods init and start.
To start the agents server an XML configuration file describing the architecture of the agent platform is needed. By default, this file is the a3servers.xml file and it should be located inside the running directory where the server is launched. Each server must use the same configuration file.
The configuration file contains a config
element, that is essentially made up of domain
s elements, and servers (server
s elements):
- Each domain of the configuration is described by an XML element with attributes giving the name and the classname for
Network
implementation (class {@link SimpleNetwork SimpleNetwork
}by default). - Each server is described by an XML element with attributes giving the id, the name (optional) and the node (the
hostname
attribute describes the name or the IP address of this node) - Each persistent server must be part of a domain (at least one), to do this you need to define a
network
element with attributes giving the domain's name (domain
attribute) and the communication port (port
attribute). - A service can be declared on any of these servers by inserting a
service
element describing it.
- Additionally, you can define property for the global configuration or for a particular server, it depends where you define it: in the
config
element or in a server one.
Each server that is part of two domains is named a "router", be careful, it should have only one route between two domains. If it is not true the configuration failed.
A simple example of a3servers.xml follows:
<?xml version="1.0"?> <!DOCTYPE config SYSTEM "a3config.dtd"> <config> <domain name="D1"/> <domain name="D2" class="fr.dyade.aaa.agent.PoolNetwork"/> <property name="D2.nbMaxCnx" value="1"/> <server id="0" name="S0" hostname="acores"> <network domain="D1" port="16300"/> <service class="fr.dyade.aaa.agent.AdminProxy" args="8090"/> <property name="A3DEBUG_PROXY" value="true"/> </server> <server id="2" name="S2" hostname="bermudes"> <network domain="D1" port="16310"/> <network domain="D2" port="16312"/> </server> <server id="3" name="S3" hostname="baleares"> <network domain="D2" port="16320"/> </server> </config>
This file described a 2 domains configuration D1 and D2, D1 with default network protocol and D2 with the PoolNetwork
one, and 4 servers:
- The first server (id 0 and name "S0") is hosted by acores, it is in domain D1, and listen on port 16300. It defines a service and a property.
- The second server (id 2) is hosted by bermudes and it is the router between D1 and D2.
- The last server is a persistent one, it is hosted on baleares and it runs in domain D2.
At the beginning of the file, there is a global property that defines the maximum number of connection handled by each server of domain D2.
@see Engine
@see Channel
@see Network
@see MessageQueue
@see fr.dyade.aaa.util.Transaction