Interface EventStreamHandler
- All Known Implementing Classes:
GatewayEventHandler
,GatewayMessageHandler
,HttpHandler
,LoggerHandler
,NoOpHandler
,ScriptHandler
,TagHandler
public interface EventStreamHandler
Handles events from Event Streams.
onStartup(EventStreamExpressionFactory)
and
onShutdown()
will only ever be called once. After a shutdown, the
EventStreamHandler
will be recreated if it's started up again.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final record
static interface
Registered withEventStreamRegistry
to create concrete implementation ofEventStreamHandler
from the provided configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoid
handle
(List<EventPayload> events, boolean testMode) Called when a batch of events is ready to be processed.default void
Called when Event Stream is shutdown and will no longer be receiving events.default void
onStartup
(EventStreamExpressionFactory expressionFactory) Called when Event Stream first starts and before theEventStreamHandler
starts receiving events throughhandle(java.util.List<com.inductiveautomation.eventstream.EventPayload>, boolean)
.
-
Method Details
-
onStartup
Called when Event Stream first starts and before theEventStreamHandler
starts receiving events throughhandle(java.util.List<com.inductiveautomation.eventstream.EventPayload>, boolean)
.- Parameters:
expressionFactory
- Factory for creatingEventStreamExpression
from expression fields.- Throws:
Exception
- An exception here will prevent the Event Stream for subscribing to source. This is useful if something fails in onStartup() thathandle(java.util.List<com.inductiveautomation.eventstream.EventPayload>, boolean)
requires to successfully process events.
-
onShutdown
default void onShutdown()Called when Event Stream is shutdown and will no longer be receiving events. -
handle
Called when a batch of events is ready to be processed. It's important that an exception is throw on errors encountered during handling of events. If an exception is encountered, it should be expected that the method may be called again in the future with the same events. This is determined by the failure strategy specified by the Event Stream configuration.- Parameters:
events
- List of events to process.testMode
- True, if Event Stream is running in test mode. If running in testMode, expressions should be evaluated with no other side effects.- Throws:
Exception
- Exception thrown during processing.
-