Interface GatewayClient

All Superinterfaces:
AutoCloseable, Monitored<List<SerializedMessage>>
All Known Implementing Classes:
LocalEventStoreClient, LocalSchedulingClient, LocalTrackingClient, WebsocketGatewayClient

public interface GatewayClient extends AutoCloseable, Monitored<List<SerializedMessage>>
Low-level interface for sending SerializedMessages to a gateway (e.g. commands, events, queries).

This interface is primarily used internally within the Flux Capacitor client and its platform transport layers. It defines the mechanics for appending serialized messages to a backing system such as the Flux platform or an in-memory store.

Note: End users typically do not interact with this interface directly. Instead, they should rely on the higher-level gateways such as:

or more conveniently, dispatch messages using the static utility methods provided by FluxCapacitor, such as:
     FluxCapacitor.sendCommandAndWait(new MyCommand());
     FluxCapacitor.publishEvent(new SomethingHappened());
 
See Also:
  • Method Details

    • append

      CompletableFuture<Void> append(Guarantee guarantee, SerializedMessage... messages)
      Append the given messages to the gateway, applying the given delivery Guarantee.
      Parameters:
      guarantee - the delivery guarantee that should be respected (e.g. at-most-once, at-least-once)
      messages - one or more serialized messages to append
      Returns:
      a CompletableFuture that completes when the append operation is successful or fails if delivery fails
    • setRetentionTime

      CompletableFuture<Void> setRetentionTime(Duration duration, Guarantee guarantee)
      Set a new retention duration for the underlying gateway's message log.

      The retention setting determines how long messages in this log are retained by the system, after which they may be evicted or deleted depending on the platform policy.

      Parameters:
      duration - the new retention duration
      guarantee - the delivery guarantee to apply to the update operation
      Returns:
      a CompletableFuture that completes once the retention setting is updated
    • close

      void close()
      Closes this gateway client, releasing any associated resources (e.g. network connections or background tasks).
      Specified by:
      close in interface AutoCloseable