Interface SseClientInitializer

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

Checked setup or catch-up work for an accepted Server-Sent Event client.

Events and comments queued by the initializer are delivered only after it returns successfully, subject to SseServer.Builder.connectionQueueCapacity(Integer). Initialization must be bounded; this callback is not an indefinite producer running after connection activation. An initializer failure terminates the connection; queued writes are discarded. The accepted response has already been written, so an initializer exception is reported by the stream-termination callbacks with StreamTerminationReason.PRODUCER_FAILED and its cause. Queue overflow elects StreamTerminationReason.BACKPRESSURE, even when caught by the initializer. An earlier termination reason still wins. Establishment observation precedes termination observation even if initialization never activates the connection. Do not retain the unicaster after this callback returns. Peer disconnection or server shutdown can prevent an initializer from entering or interrupt one already in progress. Initialization should cooperate with interruption; its lifecycle capacity remains reserved until the callback physically returns.

One initializer instance may be reused concurrently for different clients. Captured application state must support that reuse.

Author:
Mark Allen
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Initializes an accepted client before its queued writes are delivered.
  • Method Details

    • initialize

      void initialize(@NonNull SseUnicaster sseUnicaster) throws Exception
      Initializes an accepted client before its queued writes are delivered.
      Parameters:
      sseUnicaster - the unicaster for this one-time initialization
      Throws:
      Exception - if initialization fails