Agent descriptor syntax
You write the description of an agent in the agent descriptor file. The descriptor defines the events that are processed and the referenced entity.
Purpose
The agent descriptor is used to define the following attributes for an agent:- The name of the agent.
- The bound entity.
- The events that the agent processes and the related filtering conditions.
- The way to access the entity from each referenced event.
Syntax
The following syntax describes the structure of the agent descriptor.
'my agent' is an agent related to <entity> , [ whose priority is <priorityValue>,]
processing events:
- <event>
[when <condition>], where <mapping> comes from <target>
Description
Construct | Description |
---|---|
my agent is an agent related to <entity> | The name of the agent and the bound entity type.
The entity type (BOM class) introduces a variable to refer to this
entity in the rest of the description. In a Java™ agent, you do not have to specify a bound entity. You can create a Java agent that processes events only. |
, processing events : - <event> , | The declaration of the events that trigger the agent. The event type introduces an implicit variable to refer to this event in the rest of the description. |
where <mapping> comes from <target> | Defines the mapping between the entity and the event, and where to find the entity ID in the event. The <mapping> element creates a reference to the implicit variable that represents the entity ID defined in the <entity> element. The <target> element is an expression that includes the entity type or expressions of type String, and the implicit variable of the processed event. |
Construct | Description |
---|---|
whose priority is <priority value>, | Defines the priority of the agent. To express
the priority, you choose between the values High, Medium, or Low. You can also define a number
that represents the priority, considering the following scale: High is 1000000000, Medium is 0, and Low is -1000000000. The numbered
priority of an agent can be any Java integer
value between -231 and 231-1. Agents are processed in an order that is based on the priority; higher numbers are processed first. If two agents have the same priority number, then the agent name determines the processing priority. For example, an agent named Airport closed is processed before an agent named Cancelled flights. |
when <condition> | Defines the applicability condition of the event. If a condition is specified, the agent is triggered only if the condition applies. |
with a horizon of <time duration> | Defines how long events are kept in working
memory and are therefore usable by the agent. The value of <time duration> must be a positive
value, for example: 12 days 8 hours.
If the time horizon is set to 0, events are not visible to the solution
after they are processed. Setting the horizon to 0 can improve performance
for event types that occurs in high volume, but that are not used
in aggregations or correlations. The maxHorizon solution property overrides the time horizon that you can define for an event in the agent descriptor. |
Example
In the following example, the implicit variables are shown in italics:
'my agent' is an agent related to a customer,
processing events :
- customer subscribe,
where this customer comes from
the first name of the emergency contact of this customer subscribe + "/" + the last name of the emergency contact of this customer subscribe
The customer is the entity type. The customer subscribe is the event type that the agent processes. The mapping between the event and the entity is the emergency contact's first and last names.