Operation Codes (opcodes) associate insert, update, and delete events with a window. They simplify development and improve performance by applying these events automatically.
In many Event Stream Processor use cases, events are independent of each other: each carries information about something that happened. In these cases, a stream of events is a series of independent events. If you define a window on this type of event stream, each incoming event is inserted into the window. If you think of a window as a table, the new event is added to the window as a new row.
In other use cases, events deliver new information about previous events. The ESP Server needs to maintain a current view of the set of information as the incoming events continuously update it. Two common examples are order books for securities in capital markets, or open orders in a fulfillment system. In both applications, incoming events may indicate the need to:
- Add an order to the set of open orders,
- Update the status of an existing open order, or,
- Remove a cancelled or filled order from the set of open orders.
To handle information sets that are updated by incoming events, Event Stream Processor recognizes insert, update, and delete operations associated with incoming events. You can tag events with an opcode, a special field that indicates whether the event is an insert event, an update event, or a delete event. There is also an upsert opcode, which either updates an existing record with a matching key, or inserts a new record.
Input windows apply insert, update, and delete events to the data in the window directly, as events arrive. Inserts, updates, and deletes are propagated through the query graph, that is, all downstream derived windows. Thus, when an event updates or deletes a record in an input window, it automatically applies to any downstream derived windows. This native handling of updates and deletes provides high performance and simplicity. Users do not need to manually define the logic to examine incoming events and determine how to apply them to a window.
Stream と Window を別に扱っている．CQL のモデルでいう Stream と Relation だろうか．Window 内のデータが Updatable なところが注目点．