Class ServiceUrlBuilder

java.lang.Object
io.fluxcapacitor.javaclient.common.websocket.ServiceUrlBuilder

public class ServiceUrlBuilder extends Object
Utility class for constructing fully qualified service endpoint URLs for various Flux Platform features based on the client's configuration.

This class supports generating URLs for services such as message production and consumption, event sourcing, key-value storage, search, and scheduling. It combines static path segments (from ServicePathBuilder) with dynamic query parameters like client ID, name, compression settings, and topic filters from the provided WebSocketClient.ClientConfig.

This class is typically used internally by WebSocket-based gateway clients to determine which platform endpoint to connect to.

See Also:
  • Constructor Details

    • ServiceUrlBuilder

      public ServiceUrlBuilder()
  • Method Details

    • gatewayUrl

      public static String gatewayUrl(MessageType messageType, String topic, WebSocketClient.ClientConfig clientConfig)
      Builds the URL to send messages to a gateway endpoint for the specified message type and topic.
      Parameters:
      messageType - the type of message (e.g., COMMAND, EVENT, QUERY)
      topic - the topic name (optional, may be null)
      clientConfig - the WebSocket client configuration
      Returns:
      the complete gateway URL with query parameters
    • trackingUrl

      public static String trackingUrl(MessageType messageType, String topic, WebSocketClient.ClientConfig clientConfig)
      Builds the URL to subscribe to messages from a tracking endpoint for the specified message type and topic.
      Parameters:
      messageType - the type of message (e.g., COMMAND, EVENT, QUERY)
      topic - the topic to subscribe to (optional)
      clientConfig - the WebSocket client configuration
      Returns:
      the complete tracking URL with query parameters
    • eventSourcingUrl

      public static String eventSourcingUrl(WebSocketClient.ClientConfig clientConfig)
      Constructs the URL for accessing the event sourcing stream.
      Parameters:
      clientConfig - the WebSocket client configuration
      Returns:
      the complete URL for the event sourcing service
    • keyValueUrl

      public static String keyValueUrl(WebSocketClient.ClientConfig clientConfig)
      Constructs the URL for accessing the distributed key-value store service.
      Parameters:
      clientConfig - the WebSocket client configuration
      Returns:
      the complete URL for the key-value service
    • searchUrl

      public static String searchUrl(WebSocketClient.ClientConfig clientConfig)
      Constructs the URL for accessing the document and handler state search service.
      Parameters:
      clientConfig - the WebSocket client configuration
      Returns:
      the complete URL for the search service
    • schedulingUrl

      public static String schedulingUrl(WebSocketClient.ClientConfig clientConfig)
      Constructs the URL for accessing the time-based message scheduling service.
      Parameters:
      clientConfig - the WebSocket client configuration
      Returns:
      the complete URL for the scheduling service
    • buildUrl

      public static String buildUrl(WebSocketClient.ClientConfig clientConfig, String path)
      Constructs a base URL for a given service path, including query parameters derived from the given client config.

      This method is used by the service-specific builders above and includes fields such as:

      • clientId
      • clientName
      • projectId (optional)
      • compression algorithm
      Parameters:
      clientConfig - the WebSocket client configuration
      path - the service-specific path from ServicePathBuilder
      Returns:
      the constructed base URL with encoded query parameters