Package io.quarkus.stork
Class StorkRegistrarConfigRecorder
java.lang.Object
io.quarkus.stork.StorkRegistrarConfigRecorder
-
Constructor Summary
ConstructorsConstructorDescriptionStorkRegistrarConfigRecorder(io.quarkus.runtime.RuntimeValue<StorkConfiguration> runtimeConfig) -
Method Summary
Modifier and TypeMethodDescriptionvoidsetupServiceRegistrarConfig(String serviceRegistrarType, String healthCheckUrl) Builds or completes the registration config for the current Quarkus application based on the given registrar type and optional health check URL.
-
Constructor Details
-
StorkRegistrarConfigRecorder
public StorkRegistrarConfigRecorder(io.quarkus.runtime.RuntimeValue<StorkConfiguration> runtimeConfig)
-
-
Method Details
-
setupServiceRegistrarConfig
Builds or completes the registration config for the current Quarkus application based on the given registrar type and optional health check URL.This method is designed to improve the developer experience by automatically setting up service registration with minimal configuration. It ensures that service instances are registered with the appropriate backend (e.g., Consul, Eureka) even if the application does not explicitly provide full registrar settings.
Behavior:
- If no services are explicitly configured with a service registrar, a default configuration is created and registered under the application name.
- If exactly one service is configured, its configuration is completed with the missing registrar type or health check URL.
- If multiple services are configured for registration and one or more lack a type, the method fails with an exception to avoid ambiguity.
This method is intended to be used during application startup to ensure that service registration with Stork is correctly configured, particularly for automatic registration with built-in registrars.
- Parameters:
serviceRegistrarType- the type of the service registrar (e.g., "consul", "eureka"); must not be blankhealthCheckUrl- optional health check URL to register with the service (can benull)- Throws:
IllegalArgumentException- ifserviceRegistrarTypeis blankRuntimeException- if multiple services are configured for registration and any is missing a registrar type
-