Show TOC

Operation CodesLocate this document in the navigation structure

The operation code (opcode) of an event record specifies the action to perform on the underlying store of a window for that event.

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. ESP 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, and 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 canceled or filled order from the set of open orders.
To handle information sets that are updated by incoming events, Event Stream Processor recognizes the following opcodes in incoming event records:
  • insert Insert the event record.
  • update Update the record with the specified key. If no such record exists, it is a runtime error.
  • delete Delete the record with the specified key. If no such record exists, it is a runtime error.
  • upsert If a record with a matching key exists, update it. If a record with a matching key does not exist, insert this record.
  • safedelete If a record with a matching key exists, delete it. If a record with a matching key does not exist, do nothing.

All event records include an opcode. Each stream or window in the project accepts incoming event records and outputs event records. Output events, including opcodes, are determined by their source (window, stream, keyed stream, or delta stream) and the processing specified for it.

Refer to the SAP Event Stream Processor: Developer Guide for details on how windows and streams interpret the opcodes on incoming event records and generate opcodes for output records.