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.
  • Method Details

    • onStartup

      default void onStartup(EventStreamExpressionFactory expressionFactory) throws Exception
      Called when Event Stream first starts and before the EventStreamHandler starts receiving events through handle(java.util.List<com.inductiveautomation.eventstream.EventPayload>, boolean).
      Parameters:
      expressionFactory - Factory for creating EventStreamExpression 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() that handle(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

      void handle(List<EventPayload> events, boolean testMode) throws Exception
      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.