Class WebResponseGateway

java.lang.Object
io.fluxzero.sdk.web.WebResponseGateway
All Implemented Interfaces:
ResultGateway

public class WebResponseGateway extends Object implements ResultGateway
Specialized implementation of the ResultGateway interface for sending web response messages.

This class is responsible for handling responses to web requests, dispatching the result message to the specified target using a GatewayClient.

The dispatch process utilizes the DispatchInterceptor and WebResponseMapper to modify or monitor web responses before they are sent.

See Also:
  • Field Details

  • Constructor Details

    • WebResponseGateway

      public WebResponseGateway()
  • Method Details

    • respond

      public CompletableFuture<Void> respond(Object payload, io.fluxzero.common.api.Metadata metadata, String target, Integer requestId, io.fluxzero.common.Guarantee guarantee)
      Description copied from interface: ResultGateway
      Sends a response with the specified payload, metadata, target, request ID, and delivery guarantee.

      This method gives full control over how and when the response is delivered.

      Specified by:
      respond in interface ResultGateway
      Parameters:
      payload - the payload of the response
      metadata - additional metadata to include
      target - the intended recipient of the response
      requestId - the identifier of the original request
      guarantee - delivery guarantee (e.g., Guarantee.SENT or Guarantee.STORED)
      Returns:
      a CompletableFuture that completes when the response is dispatched (depending on the guarantee)
    • sendResponse

      protected CompletableFuture<Void> sendResponse(WebResponse response, Function<io.fluxzero.common.api.SerializedMessage,CompletableFuture<Void>> dispatcher)