StreamEvent

An event drives all processing. At its core Joule defines a StreamEvent that is passed from one component to another until it is ejected to consumers.


Understanding the structure and how to use this datatype will enable you to develop custom components that are optimised for processing efficiency while being flexible enough to work with.

The StreamEvent provides the vehicle to transport and process data throughout the platform

Key Features

  • Typed by source system

  • Timestamped by event occurrence at source or at time of platform ingestion

  • Changes trackable by time, value and by affecting processor

  • Cloneable, deep copy, to preseve transaction isolation within processing context

  • Serializable for extenal consumption

Attributes

AttributeDescriptionType

uuid

Unique identifier assigned by the platform to enable tracking

UUID

type

Parent type of the event e.g. market_data

String

subType

Finer grain type of the event e.g. aim

Object

eventTme

Actual time the event occured within the source system. This is set by the user.

Long

IngestTime

Actual time the event was ingested by Joule process. This is automatically assigned at point of object creation.

Long

dictionary

Store of all key event attributes.

Map<String,Object>

callChain

Tracking store of every change made to the event as it passes through the processing pipeline. This is managed by the Joule platform.

Map<Tuple<UUID, String>, Long>

StreamEvent can be located under the following package

com.fractalworks.streams.core.data.streams

Key Methods

Adding

To add new attributes to an event there are two methods which can be used. If a null value has been passed this will be converted to a String null value.

// Add field and value using the default UUID
public void addValue(String field, Object value);

// Add field and value using the passed UUID
public void addValue(UUID srcUUID, String field, Object value);

Updating

Attributes can be updated in place. If a null value has been passed this will be converted to a String null value.

// Update field and value using the passed UUID
public void replaceValue(UUID srcUUID, String field, Object value);

Get value

Either a single attribute or a the whole set of attributes values be returned to the caller

// Get value for field
public Object getValue(String field);

// Get a shallow copy of the field value dictionary
public Map<String, Object> getDictionary();

Remove

Tow methods exists to remove fields from the event.

// Remove a single field from the event
public void removeValue(UUID srcUUID, String field);

// Remove all stored field data
public void removeAll();

Cloning

A deep copy method is provided to return a new StreamEvent from the event.

// Get a deep copy of this eventfav
public StreamEvent deepCopy();

Get call chain

To get the history of changes applied to the event use the below method.

// Get the history of changes applied to the event
public Map<Triple<UUID, String,Object>, Long> getCallChain();

Last updated