The runtime environment provides several library functions that bound classes can use. This section documents the runtime
environment and how to access the library functions.
An application can register for output from the EventProcessor by supplying a consumer
to addSink. Support for publishing to a sink is built into the streaming api, [builder_type]#sink.
A consumer has a string key to partition outputs.
Output
An application can remove sink using the call EventProcessor#removeSink
Clock time
A Clock provides system independent time source nodes can use to request
the current time. Clock provides time query functionality for the processor as follows:
WallClock - current time UTC milliseconds
ProcessTime - the time the event was received for processing
EventTime - the time the event was created
The clock can be data driven from a user supplied strategy supplied as an event
See the replay example for details on data driving the clock
Code sample
Sample log
TImed alarm trigger
A fixed rate time, FixedRateTrigger class, can be
referenced by user classes. The timer will trigger at regular intervals notifying any downstream classes the timer
has expired. The FixedRateTrigger checks the time on any event process cycle
The event processor does not run threads, the FixedRateTrigger only checks for expiry on an event process cycle
Code sample
Sample log
Buffer and trigger calculation
An event processor can buffer multiple events without causing any triggers to fire, and at some point in the future
cause all potentially dirty trigger to fire. This is known as buffering and triggering it is achieved by call
EventProcessr.bufferEvent multiple times and then following it with a call EventProcessor.triggerCalculation
Code sample
Sample log
Audit logging
Structured audit log records can be published from the running event processor. See the
audit logging section in application integration for more
details.
Code sample
Sample log
EventProcessorContext - context parameters
Context parameters can be passed into the running event processor in the form of a map. Any node can access the context
map and lookup a property using an injected EventProcessorContext.
Setting a context parameter on the running instance
Code sample
Sample log
DirtyStateMonitor - node dirty flag control
A user node can query the dirty state of any dependency that is in the event processor
Any node can access the DirtyStateMonitor using an injected instance
The dirty state of a object can be queried with:
Code sample
Sample log
EventDispatcher - event re-dispatch
Events can be dispatched into the event processor as re-entrant events from a node during a calculation cycle. The
EventDispatcher class gives access to event re-dispatch
functions. In order to access the EventDispatcher for the containing event processor we use the @Inject annotation.
The event processor will inject the EventDispatcher instance at runtime.
Any events that re-entrant will be queued and only execute when the current cycle has completed.
In this example a String event handler method receives a csv like string and redispatches an int event for each element
in the record. An Integer event handler method handles each int event in a separate event cycle. The IntegerHandler class
trigger method is fired before any re-entrant events are processed, the re-entrant events are queued.