Class DefaultGenericGateway

java.lang.Object
io.fluxzero.sdk.common.AbstractNamespaced<GenericGateway>
io.fluxzero.sdk.publishing.DefaultGenericGateway
All Implemented Interfaces:
Namespaced<GenericGateway>, GenericGateway, HasLocalHandlers

public class DefaultGenericGateway extends AbstractNamespaced<GenericGateway> implements GenericGateway
  • Constructor Details

    • DefaultGenericGateway

      public DefaultGenericGateway()
  • Method Details

    • createForNamespace

      protected GenericGateway createForNamespace(String namespace)
      Specified by:
      createForNamespace in class AbstractNamespaced<GenericGateway>
    • sendAndForget

      public CompletableFuture<Void> sendAndForget(io.fluxzero.common.Guarantee guarantee, Message... messages)
      Description copied from interface: GenericGateway
      Sends multiple Message objects with a guarantee.
      Specified by:
      sendAndForget in interface GenericGateway
    • sendAndForget

      public CompletableFuture<Void> sendAndForget(io.fluxzero.common.Guarantee guarantee, UnaryOperator<io.fluxzero.common.api.SerializedMessage> interceptor, Message... messages)
      Description copied from interface: GenericGateway
      Sends multiple Message objects with a guarantee.

      Before the messages are appended to the message log in Fluxzero, they can be inspected, blocked or modified using the given interceptor.

      Specified by:
      sendAndForget in interface GenericGateway
    • sendForMessages

      public List<CompletableFuture<Message>> sendForMessages(Message... messages)
      Description copied from interface: GenericGateway
      Sends multiple messages and returns futures for their full Message responses.
      Specified by:
      sendForMessages in interface GenericGateway
    • sendAndWait

      public <R> R sendAndWait(Message message)
      Description copied from interface: GenericGateway
      Sends a message and blocks for a result with a configurable timeout.

      Timeout can be customized using @Timeout on the payload class.

      Specified by:
      sendAndWait in interface GenericGateway
    • sendForMessage

      public CompletableFuture<Message> sendForMessage(Message message, Duration timeout)
      Description copied from interface: GenericGateway
      Sends a single request message with the given effective timeout.

      The effective timeout is used for the returned future and is propagated as request metadata so tracking handlers can skip stale indexed requests before invocation. If timeout is null, the gateway falls back to timeout metadata already present on the message, then @Timeout on the payload class, and finally the request handler default. A negative timeout disables timeout handling for this request.

      Specified by:
      sendForMessage in interface GenericGateway
      Parameters:
      message - the message to send
      timeout - the timeout for this request; null uses the gateway/request handler defaults
      Returns:
      a future that completes with the response message
    • setRetentionTime

      public CompletableFuture<Void> setRetentionTime(Duration duration, io.fluxzero.common.Guarantee guarantee)
      Description copied from interface: GenericGateway
      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.

      Specified by:
      setRetentionTime in interface GenericGateway
      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
    • truncate

      public CompletableFuture<Void> truncate(io.fluxzero.common.Guarantee guarantee)
      Description copied from interface: GenericGateway
      Truncates this gateway's message log and clears associated tracking positions.
      Specified by:
      truncate in interface GenericGateway
      Parameters:
      guarantee - the delivery guarantee to apply to the truncate operation
      Returns:
      a CompletableFuture that completes once the log is truncated
    • emptyReturnMessage

      protected CompletableFuture<Message> emptyReturnMessage()
    • close

      public void close()
      Description copied from interface: GenericGateway
      Closes this gateway and releases any underlying resources.
      Specified by:
      close in interface GenericGateway
      Overrides:
      close in class AbstractNamespaced<GenericGateway>