Class AbstractClient

java.lang.Object
io.fluxcapacitor.javaclient.configuration.client.AbstractClient
All Implemented Interfaces:
Client
Direct Known Subclasses:
LocalClient, WebSocketClient

public abstract class AbstractClient extends Object implements Client
Abstract base implementation of the Client interface, providing shared logic and lifecycle management for both local (in-memory) and remote (WebSocket-based) Flux clients.

Concrete implementations such as LocalClient and WebSocketClient extend this class to define specific transport and storage mechanisms for each subsystem (event store, scheduling, etc.).

Responsibilities

  • Field Details

    • shutdownTasks

      protected final Set<Runnable> shutdownTasks
      Tracks shutdown callbacks that will be run when shutDown() is invoked.
  • Constructor Details

    • AbstractClient

      public AbstractClient()
  • Method Details

    • createGatewayClient

      protected abstract GatewayClient createGatewayClient(MessageType messageType, String topic)
      Subclasses must implement this method to return a GatewayClient for the given message type and topic.
    • createTrackingClient

      protected abstract TrackingClient createTrackingClient(MessageType messageType, String topic)
      Subclasses must implement this method to return a TrackingClient for the given message type and topic.
    • createEventStoreClient

      protected abstract EventStoreClient createEventStoreClient()
      Subclasses must implement this method to return a EventStoreClient.
    • createSchedulingClient

      protected abstract SchedulingClient createSchedulingClient()
      Subclasses must implement this method to return a SchedulingClient.
    • createKeyValueClient

      protected abstract KeyValueClient createKeyValueClient()
      Subclasses must implement this method to return a KeyValueClient.
    • createSearchClient

      protected abstract SearchClient createSearchClient()
      Subclasses must implement this method to return a SearchClient.
    • getGatewayClient

      public GatewayClient getGatewayClient(MessageType messageType, String topic)
      Returns the memoized GatewayClient for the given message type and topic. Automatically registers any previously registered ClientDispatchMonitor instances.
      Specified by:
      getGatewayClient in interface Client
      Parameters:
      messageType - the type of message (e.g. COMMAND, EVENT, etc.)
      topic - the topic to publish messages to (may be null for default)
    • monitorDispatch

      public Registration monitorDispatch(ClientDispatchMonitor monitor, MessageType... messageTypes)
      Description copied from interface: Client
      Registers a ClientDispatchMonitor to receive hooks and diagnostics when messages of the given MessageTypes are dispatched from this client.
      Specified by:
      monitorDispatch in interface Client
      Parameters:
      monitor - the dispatch monitor to register
      messageTypes - the message types to monitor
      Returns:
      a Registration handle to remove the monitor
    • getTrackingClient

      public TrackingClient getTrackingClient(MessageType messageType, String topic)
      Description copied from interface: Client
      Returns a TrackingClient for the given message type and topic.
      Specified by:
      getTrackingClient in interface Client
      Parameters:
      messageType - the type of message to track (e.g. COMMAND, EVENT, QUERY)
      topic - the topic to track messages from (may be null for default)
    • shutDown

      public void shutDown()
      Description copied from interface: Client
      Shuts down this client instance, releasing any underlying resources.

      This includes closing websocket sessions, stopping tracking, and executing registered shutdown hooks.

      Specified by:
      shutDown in interface Client
    • beforeShutdown

      public Registration beforeShutdown(Runnable task)
      Description copied from interface: Client
      Registers a shutdown hook that will be called before this client shuts down.
      Specified by:
      beforeShutdown in interface Client
      Parameters:
      task - the action to invoke before shutdown
      Returns:
      a Registration to remove the task