Agent assigned to an activity node in agentsConfig.xml can be executed within a process instance as an activity.
File format
The <DMSRoot>/apps/<application ID>/agentsConfig.xml file is used to configure an agent and is part of a workflow application project.
A sample file is displayed below:
<ActionAgentList> <ActionAgent> <Name>@TestFrameAgent</Name> <Description>For tests. Returns the first arrow. </Description> <RetryInterval>20</RetryInterval> <EscalationInterval>1</EscalationInterval> <ClassName>com.fujitsu.iflowqa.testframe.TestFrameAgent </ClassName> <ClassPath>IBPMROOT/classes</ClassPath> <ConfigFile></ConfigFile> </ActionAgent> </ActionAgentList>
The table below describes the tags:
Item | Description |
---|---|
<ActionAgentList> | List of agents. |
<ActionAgent> | Definitions of a single agent. Separate definitions for each agent must be coded within this tag. |
<Name> | Name of the agent. Value must start with a "@" to indicate that it is an agent. This name must be specified as the agent in charge of an activity node, and this activity must be set as an "Agent" activity. This means that the activity functions as an agent rather than as an ordinary activity. |
<Description> | Simple description of the agent, generally explaining its function. |
<RetryInterval> | Number of seconds between each invocation of an external service. |
<EscalationInterval> | Number of failures after which a mail is to be sent to the system administrator. |
<ClassName> | Name of the Java class associated with the agent - the class is the agent's function part. |
<ClassPath> | Classpath of the Java class associated with the agent. |
<ConfigFile> | Configuration file used by the agent. |
Agent class
The class specified in <ClassName> is the procedure used by the agent to access external services - it will be hereafter referred to as the agent class. The agent class must implement the following interface:
package com.fujitsu.iflow.server.intf; public interface ActionAgentInvoke { public String invokeService(ServerEnactmentContext sec, String configFile) throws Exception; }
The agent class uses invokeService() to invoke external services and to accept data from those services. The agent then returns STRING type data to Systemwalker Runbook Automation which gives instructions for service actions.
Execution of an agent class results in one of the following:
NULL STRING type or empty STRING type data:
The agent repeatedly attempts to execute the service. The retry interval is specified in <RetryInterval> and the agent attempts execution up to the number of times specified in <EscalationInterval> - each attempt sends mail to the address specified in the Admin Server ServerEmailAddress parameter.
Other STRING type data:
The agent checks whether the data matches one of the outgoing arrow names used as the start point for agent activities. If it does, then the process instance proceeds in accordance with the matching arrow, otherwise the agent sends a "cannot-find-arrow exception" and an error occurs for the process instance.
Exception:
The agent sends the exception to Systemwalker Runbook Automation and an error occurs for the process instance.