Class RuntimeServer.Builder

java.lang.Object
ai.singlr.runtime.RuntimeServer.Builder
Enclosing class:
RuntimeServer

public static final class RuntimeServer.Builder extends Object
Mutable builder for RuntimeServer.
  • Method Details

    • withRegistry

      Bind the registry the service exposes.
      Parameters:
      registry - non-null registry
      Returns:
      this builder
      Throws:
      NullPointerException - if registry is null
    • withOptionsFactory

      public RuntimeServer.Builder withOptionsFactory(Function<String, ai.singlr.session.SessionOptions> optionsFactory)
      Bind the options factory the service calls for every POST /sessions request.
      Parameters:
      optionsFactory - non-null function from session id to options
      Returns:
      this builder
      Throws:
      NullPointerException - if optionsFactory is null
    • withObjectMapper

      public RuntimeServer.Builder withObjectMapper(tools.jackson.databind.ObjectMapper objectMapper)
      Override the default JsonMapper. Most callers should leave this alone.
      Parameters:
      objectMapper - non-null mapper
      Returns:
      this builder
    • withRoutePrefix

      Override the URL prefix the service is mounted under (default /v1).
      Parameters:
      routePrefix - non-blank prefix; leading slash required
      Returns:
      this builder
    • withPort

      public RuntimeServer.Builder withPort(int port)
      Bind the HTTP listen port. Default 0 (kernel-assigned). Tests should leave this at the default; production deployments typically pass an explicit port via configuration.
      Parameters:
      port - non-negative port (0 = random)
      Returns:
      this builder
    • withHost

      Bind the HTTP listen host. Default 127.0.0.1 (loopback only — fail-secure). Pass "0.0.0.0" or a specific external interface to expose the service beyond the host; note that the HTTP routes are unauthenticated and the POST /sessions surface creates real model-spending sessions, so external binds should sit behind authenticated fronting infrastructure.
      Parameters:
      host - non-blank host
      Returns:
      this builder
    • build

      public RuntimeServer build()
      Build and start the server.
      Returns:
      the started server
      Throws:
      IllegalStateException - if registry or optionsFactory was never set