Class StorkRegistrarConfigRecorder

java.lang.Object
io.quarkus.stork.StorkRegistrarConfigRecorder

public class StorkRegistrarConfigRecorder extends Object
  • Constructor Details

    • StorkRegistrarConfigRecorder

      public StorkRegistrarConfigRecorder(io.quarkus.runtime.RuntimeValue<StorkConfiguration> runtimeConfig)
  • Method Details

    • setupServiceRegistrarConfig

      public void setupServiceRegistrarConfig(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.

      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 blank
      healthCheckUrl - optional health check URL to register with the service (can be null)
      Throws:
      IllegalArgumentException - if serviceRegistrarType is blank
      RuntimeException - if multiple services are configured for registration and any is missing a registrar type