Log Window

The log window is a Flex operator that is assigned to a log store and is the centre of the guaranteed delivery (GD) mechanism.

For persistent subscription using persistent subscribe pattern (PSP), attach the output adapter to a log window instead of a stream of interest. The stream definition for the log window contains all the columns belonging to the stream of interest, plus two additional columns. These additional columns are the gdKey (long) and the gdOpcode (integer).

The gdKey is a constantly increasing value that uniquely identifies every event, regardless of the opcode in the stream of interest. This serves as the key for the log window. The gdOpcode is the operation code (for example, INSERT, UPDATE, or DELETE) of the event that occurs in the stream of interest.

The log window takes two inputs namely from the stream whose data needs to be delivered in a guaranteed fashion (stream of interest) and from the truncate window. The log window has a method associated with each input. The method associated with the stream of interest:
  1. Increments the gdKey by 1, starting from 0, on every incoming event. On restart, it starts from the last generated sequence number by self inspecting the data it has previously output.
  2. Determines the opcode of the incoming event.
  3. Outputs the gdKey and the gdOpcode determined in the previous two steps, along with all the columns of the input event from the stream of interest.

The method associated with the truncate window is responsible for ensuring that the data in the log window does not grow indefinitely. Every time an event occurs on the truncate window, this method deletes all events in the log window that has a gdKey less than or equal to the provided gdKey, and provided that the purge data flag is set to true.