liveBook · Manning

Enrich agent

As explained in Event Processing in Action

An enrich agent is a translate agent that adds information to an event using data obtained from a global state element.

An enrich agent is a translate event processing agent (EPA) that takes one input event, queries a global state element, and produces one derived event. The output includes the original attributes, possibly with modified values, and may include new attributes calculated from the query results. section 6.2.4

A global state element holds data accessible to one or more event processing agents. An enrich agent can use it to obtain reference data: information that changes relatively slowly and is often external to the event processing application. Enrichment can add information or correct existing values for data cleansing. section 8.2.1 section 6.2.4

Enriching a delivery request

A Fast Flower Delivery request contains a store attribute. The Request enrichment agent uses it as a key to look up the store’s neighborhood and minimum acceptable driver ranking, then adds both values to the output event. A lookup can be expressed as SELECT MinRank, Region FROM StoreRef WHERE Store = ? section 8.2.1

Figure 8.10. The Request enrichment agent from the Fast Flower Delivery application. This agent uses the store attribute of the input event to find the flower store’s neighborhood and the minimum driver ranking that is acceptable to it, and adds these values as attributes to the output event.

Follow the store attribute from the incoming request through the lookup to the enriched output event. section 8.2.1

Enrich and project are both special cases of translate. Enrich uses global state to add or change values; project selects a subset of the input event’s attributes. section 6.2.4

How Event Processing in Action covers it

How deep it goes
Defines the input, global-state query and derived output, then illustrates the lookup with a delivery-request example.
Examples
Illustrates customer address enrichment and a store lookup for neighborhood and minimum driver ranking.
What you can do after
Evaluate how a reference-data lookup can augment or correct event attributes.
How it connects
Connects translate agents, global state, reference data, data cleansing and project agents.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Event Processing in Action. The section links point to the parts of the book it draws on.