Interface WatchClient.StateListener<T>

Type Parameters:
T - the stateful type
All Known Subinterfaces:
FilesContext.FilesListener, PersistentQueriesContext.PersistentQueriesListener, RoutingFileContext.RoutingFileListener, SchemaContext.SchemasStateListener, UpdateInfoContext.UpdateInfoListener
Enclosing interface:
WatchClient

public static interface WatchClient.StateListener<T>
A watch listener style interface for a stateful type T.
  • Method Details

    • onInitialState

      void onInitialState(@NotNull @NotNull HeaderResponse header, @NotNull T state)
      Invoked exactly once before the watch begins if the state is present.

      Note: if there is an exception after this call, but before WatchClient.Watch.startWatch() is called, the exception is *not* presented to this listener. (Todo: consider changing this.)

      Parameters:
      header - the header
      state - the state
    • onInitialStateNotPresent

      void onInitialStateNotPresent(@NotNull @NotNull HeaderResponse header)
      Invoked exactly once before the watch begins if the state is not present.

      Note: if there is an exception after this call, but before WatchClient.Watch.startWatch() is called, the exception is *not* presented to this listener. (Todo: consider changing this.)

      Parameters:
      header - the header
    • onNextState

      void onNextState(@NotNull @NotNull WatchResponseUnit unit, @NotNull T state)
      Invoked on new revisions where the state is present.

      Can be called many times but is never called after onError(Throwable) or onCompleted() are called.

      Parameters:
      unit - the changes reflected in the current state update
      state - the state after applying updates in unit
    • onNextStateNotPresent

      void onNextStateNotPresent(@NotNull @NotNull WatchResponseUnit unit)
      Invoked on new revisions where the state is not present.

      Can be called many times but is never called after onError(Throwable) or onCompleted() are called.

      Parameters:
      unit - the unit
    • onError

      void onError(@NotNull @NotNull Throwable throwable)
      Invoked on errors.

      May only be called once and if called it must be the last method called.

      Parameters:
      throwable - the error
    • onCompleted

      void onCompleted()
      Invoked on completion.

      May only be called once and if called it must be the last method called.