Object - streams : StreamEvent

The StreamEvent object is a wrapper around the actual data being received to the input stream. If a record is receive to a input stream, that record is converted to a map of anydata values and set that map to a field called data in a new StreamEvent object. StreamEvent is only used internally to transmit event data from one processor to another processor. At the time the record is converted to a map, the timestamp is set. If the record is first received by the input stream, the eventType is set to streams:CURRENT. Other than stream events of type streams:CURRENT, there are 3 types of StreamEvents. They are streams:EXPIRED, streams:RESET, streams:TIMER. An expired event is used to remove the state of its respective current event. A reset event is used to completely wipe the state and a timer event is used to trigger the process method of a particular processor in timely manner.

Constructor

__init

([string, map] | [string, map] | map eventData, EventType eventType, int timestamp)

  • timestamp int

Methods

Fields

  • timestamp int
  • arrival timestamp

  • data map {}
  • event data

  • dataMap map {}
  • event data map

  • streamName string
  • name of the initial stream

  • eventId string
  • unique id of the event

copy

()

returns StreamEvent

Returns a copy of the stream event instance.

  • Return Type

    (StreamEvent)
  • A copy of the StreamEvent object with its state.

addData

Adds key values pairs in a given map to the field data.

Parameters

  • eventData map
  • map of anydata values to be added to field data.

addAttribute

Adds an attribute of an event to the map with its value.

Parameters

  • key string
  • The key of the map entry.

  • val anydata
  • Respective value of the key.

get

(string path)

returns anydata

Returns the value of an attribute.

Parameters

  • Return Type

    (anydata)
  • the attribute value.

getStreamName

()

returns string

Returns the name of the stream.

  • Return Type

    (string)
  • the stream name.

getEventId

()

returns string

Returns the id of the event.

  • Return Type

    (string)
  • the event id.

cloneData

()

returns map

Returns a clone of the event data.

  • Return Type

    (map)
  • clone of the event data.

cloneDataMap

()

returns map

Returns a clone of the event data map.

  • Return Type

    (map)
  • clone of the event data map.

toData

Copy values of a given dataMap into the self.data field.

Parameters

  • dataMap map
  • map containg event attribute values.

toDataMap

Copy values of a given data into the self.dataMap field.

Parameters

  • data map
  • map containg event attribute values.