Rule-based event-driven solutions
To build your solution, you route events to entities by using agents.
Decision Server Insights relates events to entities by using agents. Agents process events by using correlations, aggregations, rules, or predictive models to identify risks or opportunities. Agents are often triggered by the arrival of events, but can also be scheduled for execution.
A developer of an agent is responsible for writing the business logic that updates the state of an entity that is based on an incoming event.
The business logic in an agent can undertake several types of operations, which can be combined:
- Use the library of date and time data types to create rules that use time instants, durations, and time periods. The rule language and underlying algorithms are time zone aware and use Daylight Saving Time, when necessary.
- Use the base business object model and vocabulary for spatial data types and algorithms.
- Collect events over the recent (or not so recent) past and then count, aggregate, and filter them.
- Emit new events:
- Emit a new event as a result of an incoming event.
- Emit a new event that is based on the data in the incoming event.
- Emit a new event that is based on the state of the entity, or state accessible from the entity. State can include temporal and spatial filtering on properties of the entity.
- Create a primary entity from an ID in the received event. If the entity does not exist already, some default values are used. The agent can then initialize the entity further by using data within an event.
- Create an object as a result of receiving an event.
- Update properties of the entity that are based on the state of the entity and the data in the incoming event.
- Remove the entity that is bound to the agent.
- Schedule a future call of the agent.
- Detect missing events, for example, blocking a credit card if it is sent to the customer and is not activated within 7 days.
A solution is represented by an Eclipse project that refers to a set of agent project dependencies. An agent is represented by a Java™ agent project, a rule agent project, or a predictive scoring agent. A solution project always has a BOM project, which contains a .bmd file and an aggregates folder.
To develop and test a solution:
- Create a solution project.
Endpoints are required if the solution receives or emits events to the outside world. A project needs to specify the incoming and outgoing JMS and HTTP connections.
Classifiers and transformations are required to transform a message into a recognized event only if the message does not conform to the XML schema of an event that is recognized by the solution.
The solution project wizard creates a business object model (BOM) project if you do not already have one. A new BOM project contains an empty BOM.
- Import definitions or define the entities and events in the business
model definition editor.
Select a root XML schema file (.xsd) to import existing events into the BOM, and use the business definition language to create the required entities and concepts.
- If you did not use the vocabulary wizard in the previous step, generate a vocabulary for the objects in your BOM.
- Set relationships between the objects of the model.
- Create a rule agent project.
Select from the available event types in the referenced BOM and establish the routing logic. You must define the conditions that determine which situations apply to the agent, and identify the entity on which the agent acts.
Note: A rule agent must be bound to an entity, but a Java agent does not have to be. It is valid to create Java agents that operate over single events or a sequence of events independent of any entity. - Write rule agent business logic.
Add rules to the rule agent project. The rules can reference all types on the BOM path. The editor is aware of the event types that the agent wants to process, as well as the routing logic. You use standard stateless and stateful rule semantics to express the function of the agents. Rules can generate events themselves and emit them into and out of the system. The vocabulary within the rule agent has the following access rights:
- Read/write on all properties of the primary entities.
- Read-only on properties of entities that are referenced through relationships.
- Read-only on event properties.
- Create an Insight Server or use the cisDev server that is installed by default.
- Deploy the
solution artifact to the server.
Agent descriptors allow the runtime environment to route the events to a specific agent, and load the data that is needed to execute the event processing business logic.
Note: The deployed solution is versioned and can be deployed dynamically to the runtime environment. - Use the Java API to connect to a solution gateway,
instantiate the necessary entities, and send an event payload to an Insight Server.
For more information, see Testing solutions.
- Run the application to submit events and see the agents execute as a result.