Class DefaultWebRequestGateway

java.lang.Object
io.fluxzero.sdk.web.DefaultWebRequestGateway
All Implemented Interfaces:
Namespaced<WebRequestGateway>, WebRequestGateway, HasLocalHandlers

public class DefaultWebRequestGateway extends Object implements WebRequestGateway
Default implementation of the WebRequestGateway interface that delegates requests to a configured GenericGateway. This class acts as a bridge for handling outbound web requests using Fluxzero Runtime’s proxy mechanism.

It supports sending web requests in both asynchronous (fire-and-forget, future-based) and synchronous (blocking) manners, utilizing the underlying delegate to process the actual interactions with the Fluxzero Runtime.

See Also:
  • Constructor Details

    • DefaultWebRequestGateway

      public DefaultWebRequestGateway()
  • Method Details

    • sendAndForget

      public CompletableFuture<Void> sendAndForget(Guarantee guarantee, WebRequest... requests)
      Description copied from interface: WebRequestGateway
      Sends one or more web requests without waiting for a response.

      Use this for fire-and-forget scenarios (e.g., async webhook posts).

      Specified by:
      sendAndForget in interface WebRequestGateway
      Parameters:
      guarantee - indicates whether to wait until the request is sent or stored
      requests - the web requests to send
      Returns:
      a future that completes once the requests have been sent or stored
    • send

      public CompletableFuture<WebResponse> send(WebRequest request, WebRequestSettings settings)
      Description copied from interface: WebRequestGateway
      Sends the given web request using given request settings and returns a future that completes with the response.

      The request must have an absolute URL to be forwarded by the Fluxzero proxy.

      Specified by:
      send in interface WebRequestGateway
      Parameters:
      request - the web request to send
      Returns:
      a future completed with the WebResponse
    • sendAndWait

      public WebResponse sendAndWait(WebRequest request, WebRequestSettings settings)
      Description copied from interface: WebRequestGateway
      Sends the given web request using the specified request settings and waits for the response synchronously.

      This method blocks the calling thread until the request is completed or times out.

      The request must have an absolute URL to be forwarded by the Fluxzero proxy.

      Specified by:
      sendAndWait in interface WebRequestGateway
      Parameters:
      request - the web request to send
      settings - configuration settings for this request (e.g., timeouts, accepted encodings)
      Returns:
      the received WebResponse
    • forDefaultNamespace

      public DefaultWebRequestGateway forDefaultNamespace()
      Description copied from interface: Namespaced
      Returns the resource scoped to the default namespace.
      Specified by:
      forDefaultNamespace in interface Namespaced<WebRequestGateway>
      Returns:
      the resource which is associated with the default namespace
    • forNamespace

      public DefaultWebRequestGateway forNamespace(String namespace)
      Description copied from interface: Namespaced
      Creates and returns the resource scoped to the specified namespace.
      Specified by:
      forNamespace in interface Namespaced<WebRequestGateway>
      Parameters:
      namespace - the namespace to which the returned resource is scoped
      Returns:
      the resource associated with the specified namespace