A translate agent is a stateless transformation event processing agent (EPA). For each input event, it uses a derivation formula to produce one derived event, independently of preceding or subsequent events. section 2.3.4 section 6.2.4
The derivation expression specifies how to compute each output attribute. A translation can copy, add, remove, or change attributes, or convert an event from one type to another. section 6.2.4 section 8.2.1
Translating an order event
An input event has numItems 10 and price 17. A translation produces an event with orderType “Low”, an adjusted price of 14.78, and total 170, computed from the input price and number of items. The output need not retain every input attribute. section 8.2.1
Listing 8.1. XSLT stylesheet performing the transformation
An XSLT stylesheet implements the order-event translation, setting orderType and calculating price and total. section 8.2.1
Two special cases of translation are useful building blocks:
- A project agent produces an event containing a subset of the input attributes. For example, it can retain a stock ticker and volume-weighted average price while leaving out minimum and maximum prices. section 6.2.4 section 8.2.1
- An enrich agent queries a global state element using the input event, then uses the result to add or modify attributes. For example, it can use a customer number to add a name and address. section 6.2.4
Unlike a translate agent’s one-input, one-output operation, a split agent produces multiple events from one input, while an aggregate agent produces one event from multiple inputs. A compose agent combines two event streams. section 2.3.4
