Agent - cristal-ise/kernel GitHub Wiki
Agents are the executors of CRISTAL activities. As activity execution is the only way of changing the state of the data in Items, all client processes that wish to write data to CRISTAL must do so through the use of an Agent. Agents are an abstract representation of users of the system. The Agent object itself is stored in the server, and is a subclass of Item. However, client processes may authenticate as an Agent using the connect(user, pass, resource)
or login(user, pass, resource)
methods of the Gateway, receiving an AgentProxy object that they may use to interact with the system. The AgentProxy contains many methods for this, and additional utility methods for simplifying common tasks such as object marshalling, so should be considered to be the central point of the CRISTAL client API.
Agents hold [Roles]], which enable them to execute [Jobs. Client processes may query Items for Jobs available using ItemProxy.getJobList(AgentProxy)
. Persistent Jobs, which are generated by Activities when they change state, are stored in the JobList
storage cluster in the Agent object itself. These Jobs are only generated when the Role of the activity is set to push Jobs to its Agents. Client processes may use the Proxy Subscription mechanism to be informed when new Jobs are available for its Agent(s). For more details, see: JobExecution
There are four distinct usages of Agents:
- A human user. Logs into the system and executes Jobs through a UI.
- An instrument, such as a piece of production-line machinery.
- A software agent. May be a worker process using a Passive Agent to receive Jobs from the server and execute them, or an Active Agent that acts on some external stimulus.
- The system agent. This Agent ('system', UUID 0) does not have a password, so should not be used outside of the server process. It is used internally in the server to label data it has written outside of the activity execution mechanism.
Creation
Agents can be defined very simply in a module description: limited to name, roles and password. Within the Item model, they can be created using the PredefinedStep CreateAgentFromDescription
which, similar to its Item version, instantiates a new Agent using the current Item or Agent as a description, but includes extra parameters for specifying the Role and initial password of the new Agent.