Interface EventStreamManager


public interface EventStreamManager
  • Method Details

    • getSourceRegistry

      SourceRegistry getSourceRegistry()
      Returns registry for EventStreamSource.Factory
    • getHandlerRegistry

      HandlerRegistry getHandlerRegistry()
      Returns registry for EventStreamHandler.Factory
    • getEncoderRegistry

      EncoderRegistry getEncoderRegistry()
      Returns registry for EncoderFactory
    • publishEvent

      Future<EventResult> publishEvent(String project, String path, String message, boolean ack, @Nullable String gatewayName)
      Publishes an event to GatewayEvent source.
      Parameters:
      project - Project of destination Event Stream
      path - Path of destination Event Stream
      message - String to deliver to destination Event Stream
      ack - True, the Future will complete once processed by destination handlers. False, will complete when the message reaches the destination GatewayEventSource.
      gatewayName - Gateway Name of remote gateway, if sending across Gateway Area Network.
      Returns:
      Result of publish
    • getDiagnostics

      @Nullable EventStreamDiagnostics getDiagnostics(String project, String path)
      Returns current EventStreamDiagnostics, or null if no Event Stream is found.
      Parameters:
      project - Project Event Stream belongs to
      path - Path of Event Stream
    • runEventStream

      EventStreamDiagnostics runEventStream(String project, String path, EventStreamConfig config, EventStreamRunConfig runConfig)
      Starts an EventStream based on config and runConfig.
      Allows for testing one-off EventStreams.

      A previewing runConfig additionally computes the shape a downstream stage would receive. Both previews describe an event the deployed Event Stream's Source really emitted, and differ in what they must do to answer:

      • Source — that event, re-encoded through config's Source encoder. Encoders only transform event data, so the reported metadata is the Source event's unchanged. The event is read from the shared cache, so no stream runs: config is read for that encoder alone.
      • Transform — the "post-transform shape" a downstream Handler or the error handler would receive, by running the given (live, possibly-edited) config over that event up to and including the Transform, then encoding the Transform's output. This reflects the Transform code currently being edited — the run replaces config's Source with LAST_EVENT, so the cached raw event is re-encoded through the current Source encoder before the Transform runs, and the output is encoded with config's Transform encoder. The run is a throwaway that touches no shared cache.

      Neither preview is told which encoder to describe its output with: it is the one the previewed stage already carries in config, which is what makes the encoded result a preview of what the next stage would really see.

      Parameters:
      project - Project that Event Stream belongs to
      path - Path to Event Stream
      config - EventStreamConfig of the Event Stream. A Source preview runs nothing of this, but still reads its Source encoder.
      runConfig - Special configuration determining how the EventStream should be run
      Returns:
      EventStreamDiagnostics produced from the run. For a preview, EventStreamDiagnostics.previewOutput() carries an EventPreview.Success with the encoded output, or an EventPreview.Failure when the preview could not be produced — no Source event has been captured, no Transform is enabled to preview, a stage faulted or threw while running, the stream could not be built, or the output cannot be encoded by the configured encoder. Those reasons are carried in the result rather than thrown, so callers can surface them; for a run that asked for no preview, that component is null and a stream that cannot be built throws instead.
    • getState

      EventStreamState getState(String project, String path)
      Returns the current state of the Event Stream.
      Parameters:
      project - Project Event Stream belongs to
      path - Path of Event Stream
      Returns:
      EventStreamState of the Event Stream
    • listAllEventStreams

      List<EventStreamDescription> listAllEventStreams()
      Returns all registered Event Streams. Event Streams can be in any state.
      Returns:
      List of EventStreamDescription
    • listEventStreams

      List<EventStreamDescription> listEventStreams(String project)
      Returns a list of registered Event Streams for a project. Event Streams can be in any state.
      Parameters:
      project - Project to target
      Returns:
      List of EventStreamDescription for the project
    • validateExpression

      boolean validateExpression(String project, ExpressionValue expressionValue)
      Validates the provided expression for correctness and consistency within the given project context.
      Parameters:
      project - The name of the project in which the expression is being validated. Expected to be non-null and non-empty.
      expressionValue - The ExpressionValue object containing the data and type of the field to validate. Cannot be null.
    • get

      static EventStreamManager get(GatewayContext context)
      Returns the EventStreamManager for the given GatewayContext.