Usage¶
To create primary agent:
- implement the
AgentProgram
interface, which represents the program of the agent; - create an instance of the
PrimaryAgent
class passing all the needed parameters: the URI of the agent, implemented program, type and code of the substitute program, address and name of the SIB; - call the
joinSIB
method on createdPrimaryAgent
class instance.
To create substitute agent:
- implement the
SubstituteAgentProgram
interface, which represents the program of the agent and depends on gathered from substituted agent code; - create an instance of the
SubstituteAgent
class passing all the needed parameters: type of the substitute program, implemented program, address and name of the SIB; - call the
joinSIB
method on createdSubstituteAgent
class instance.
Both primary and substitute agents can be shutdowned by calling the shutdown
method.
In addition, the PrimaryAgent
class contains the suspendOperation
method that deactivates the agent provoking it to be substituted.