Object - streams : Count

Aggregator to count events in streams.

Methods

Fields

  • count int 0
  • description

process

(anydata value, EventType eventType)

returns anydata

Updates the current count when a new event arrives and return the updated count. If the eventType is streams:CURRENT, count is increase by 1. If the eventType is streams:EXPIRED, count is descreased by 1. If the eventTypeis streams:RESET, count is reset, regardless the value.

Parameters

  • value anydata
  • In count aggregator the value is not used.

  • eventType EventType
  • Type of the incoming event streams:CURRENT, streams:EXPIRED or streams:RESET.

  • Return Type

    (anydata)
  • Updated count.

copy

()

returns Aggregator

Returns a copy of the Count aggregator without its current state.

  • Return Type

    (Aggregator)
  • Returns Count aggregator.

saveState

()

returns map

Return current state to be saved as a map of any typed values.

  • Return Type

    (map)
  • A map of any typed values.

restoreState

Restores the saved state which is passed as a map of any typed values.

Parameters

  • state map
  • A map of typed any values. This map contains the values to be restored from the persisted data.