Class RuntimeServer.Builder
java.lang.Object
ai.singlr.runtime.RuntimeServer.Builder
- Enclosing class:
RuntimeServer
Mutable builder for
RuntimeServer.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build and start the server.Bind the HTTP listen host.withObjectMapper(tools.jackson.databind.ObjectMapper objectMapper) Override the defaultJsonMapper.withOptionsFactory(Function<String, ai.singlr.session.SessionOptions> optionsFactory) Bind the options factory the service calls for everyPOST /sessionsrequest.withPort(int port) Bind the HTTP listen port.withRegistry(SessionRegistry registry) Bind the registry the service exposes.withRoutePrefix(String routePrefix) Override the URL prefix the service is mounted under (default/v1).
-
Method Details
-
withRegistry
Bind the registry the service exposes.- Parameters:
registry- non-null registry- Returns:
- this builder
- Throws:
NullPointerException- ifregistryis null
-
withOptionsFactory
public RuntimeServer.Builder withOptionsFactory(Function<String, ai.singlr.session.SessionOptions> optionsFactory) Bind the options factory the service calls for everyPOST /sessionsrequest.- Parameters:
optionsFactory- non-null function from session id to options- Returns:
- this builder
- Throws:
NullPointerException- ifoptionsFactoryis null
-
withObjectMapper
Override the defaultJsonMapper. 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
Bind the HTTP listen port. Default0(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. Default0.0.0.0.- Parameters:
host- non-blank host- Returns:
- this builder
-
build
Build and start the server.- Returns:
- the started server
- Throws:
IllegalStateException- ifregistryoroptionsFactorywas never set
-