Class DefaultCommandGateway

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

public class DefaultCommandGateway extends AbstractNamespaced<CommandGateway> implements CommandGateway
Default implementation of the CommandGateway interface.

This class delegates all functionality to an underlying GenericGateway instance, enabling the use of command gateway methods while leveraging the generic gateway's capabilities.

See Also:
  • Constructor Details

    • DefaultCommandGateway

      public DefaultCommandGateway()
  • Method Details

    • send

      public <R> CompletableFuture<R> send(Object payload, io.fluxzero.common.api.Metadata metadata, io.fluxzero.common.Guarantee guarantee)
      Description copied from interface: CommandGateway
      Sends a request with the given publication guarantee. The future represents its business response. Guarantee.DEFAULT uses fluxzero.publishing.defaultGuarantee, with the SDK major-version request default when unconfigured. Guarantee.NONE, Guarantee.SENT and Guarantee.STORED override publication for this call only; the business result is still awaited.
      Specified by:
      send in interface CommandGateway
      Type Parameters:
      R - response payload type
      Parameters:
      payload - request payload
      metadata - request metadata; use Metadata.empty() when none is needed
      guarantee - request publication guarantee
      Returns:
      the business response future
    • send

      public <R> CompletableFuture<R> send(Request<R> payload, io.fluxzero.common.api.Metadata metadata, io.fluxzero.common.Guarantee guarantee)
      Description copied from interface: CommandGateway
      Sends a typed request with a per-call publication guarantee and returns its business response future.
      Specified by:
      send in interface CommandGateway
    • sendAndWait

      public <R> R sendAndWait(Object payload, io.fluxzero.common.api.Metadata metadata, io.fluxzero.common.Guarantee guarantee)
      Description copied from interface: CommandGateway
      Sends a request with a per-call publication guarantee and waits for its business response. Storage acknowledgment does not replace or delay an already available business response.
      Specified by:
      sendAndWait in interface CommandGateway
    • sendAndWait

      public <R> R sendAndWait(Request<R> payload, io.fluxzero.common.api.Metadata metadata, io.fluxzero.common.Guarantee guarantee)
      Description copied from interface: CommandGateway
      Sends a typed request with a per-call publication guarantee and waits for its business response.
      Specified by:
      sendAndWait in interface CommandGateway
    • sendForMessages

      public List<CompletableFuture<Message>> sendForMessages(io.fluxzero.common.Guarantee guarantee, Message... messages)
      Description copied from interface: CommandGateway
      Sends full request messages with one publication guarantee and returns business response futures in input order. Custom gateways retain their existing batch behavior for DEFAULT; unsupported explicit guarantees fail.
      Specified by:
      sendForMessages in interface CommandGateway
    • createForNamespace

      protected CommandGateway createForNamespace(String namespace)
      Specified by:
      createForNamespace in class AbstractNamespaced<CommandGateway>
    • forNamespace

      public DefaultCommandGateway forNamespace(String namespace)
      Description copied from interface: Namespaced
      Returns the resource scoped to the specified namespace. Passing null selects the namespace configured for this application.
      Specified by:
      forNamespace in interface Namespaced<CommandGateway>
      Overrides:
      forNamespace in class AbstractNamespaced<CommandGateway>
      Parameters:
      namespace - the namespace to which the returned resource is scoped, or null for the application namespace
      Returns:
      the resource associated with the specified namespace