Class DevServicesResultBuildItem.OwnedServiceBuilder<T extends Startable>

java.lang.Object
io.quarkus.deployment.builditem.DevServicesResultBuildItem.OwnedServiceBuilder<T>
Enclosing class:
DevServicesResultBuildItem

public static class DevServicesResultBuildItem.OwnedServiceBuilder<T extends Startable> extends Object
  • Constructor Details

    • OwnedServiceBuilder

      public OwnedServiceBuilder()
  • Method Details

    • name

      Deprecated.
      Use feature(String) instead
      Parameters:
      name - the name of the owning feature
      Returns:
      the builder, for chaining
    • feature

      Identifies the feature which owns this service. The feature's name is used for identification and lifecycle managemennt. This should always be set. Use feature(String) if a feature object is not available.
      Parameters:
      feature - the owning feature
      Returns:
      the builder, for chaining
    • feature

      Identifies the feature which owns this service. The feature's name is used for identification and lifecycle managemennt. This should always be set. Also see feature(Feature), which can be used when a feature object is available.
      Parameters:
      featureName - the name of the owning feature
      Returns:
      the builder, for chaining
    • description

      public DevServicesResultBuildItem.OwnedServiceBuilder<T> description(String description)
      Sets a human-readable description of the service.

      Optional.

      Parameters:
      description - the service description
      Returns:
      the builder, for chaining
    • config

      Defines config which should be injected into the config system when this service is started. All values must be known up-front, at build time.

      This is easier to use than configProvider(Map) because there are no lambdas, but it is also more limited. The two methods can co-exist, with static values being set via config(Map) and lazy or dynamic ones being set via configProvider(Map).

      Optional.

      Parameters:
      config - a map of config keys and fixed values
      Returns:
      the builder, for chaining
    • serviceName

      public DevServicesResultBuildItem.OwnedServiceBuilder<T> serviceName(String serviceName)
      If the feature provides multiple dev services, this is the name of the service. Used for identification and lifecycle management, along with the feature(Feature).

      Optional, only needed if there are multiple services for a feature.

      Parameters:
      serviceName - a name specific to this service, when there are several
      Returns:
      the builder, for chaining
    • serviceConfig

      public DevServicesResultBuildItem.OwnedServiceBuilder<T> serviceConfig(Object serviceConfig)
      Declares the configuration of this service. This is used as a uniqueness identifier to establish whether services should be restarted, for example between live reloads. Usually it would be the config object passed in to the build step, but if the reuse semantics are different, it could be a subset or superset of that object. If you want your service to be restarted when the config is different, and re-used otherwise, pass through your config. If you want it to be always restarted on live reloads, you could pass through something like a random number. If you want the service to never be restarted, you could pass through a constant.
      Parameters:
      serviceConfig - an object with defining characteristics of the service. It will be reflectively compared to the previous configuration.
      Returns:
      a builder, for chaining
    • dependsOnConfig

      public DevServicesResultBuildItem.OwnedServiceBuilder<T> dependsOnConfig(String key, BiConsumer<T,String> function)
      Declares that this dev service should not be started until config from a dependency dev service is available. Before service start, the `DevServiceConfigDependency`` will be given an opportunity to inject the required config into the `Startable`.

      If the config key never becomes available, the service will not be started.

      This method can be called multiple times, and all of the config values will be injected.

      Parameters:
      key - the config key which should be waited for; will never be null
      function - a function which should be invoked on the startable to pass in the config
      Returns:
      a builder, for chaining
    • dependsOnConfig

      public DevServicesResultBuildItem.OwnedServiceBuilder<T> dependsOnConfig(String key, BiConsumer<T,String> function, boolean optional)
      Declares that this dev service should not be started until config from a dependency dev service has a chance to become available. Before service start, the `DevServiceConfigDependency`` will be given an opportunity to inject the required config into the `Startable`.

      This method can be called multiple times, and all of the config values will be injected.

      Parameters:
      key - the config key which should be waited for
      function - a function which should be invoked on the startable to pass in the config; will not be called if the config never becomes available
      optional - whether to start the service if the config never becomes availbale
      Returns:
      a builder, for chaining
    • startable

      public <S extends Startable> DevServicesResultBuildItem.OwnedServiceBuilder<S> startable(Supplier<S> startableSupplier)
    • postStartHook

      public DevServicesResultBuildItem.OwnedServiceBuilder<T> postStartHook(Consumer<T> postStartAction)
    • highPriorityConfig

      @Deprecated(forRemoval=true) public DevServicesResultBuildItem.OwnedServiceBuilder<T> highPriorityConfig(Set<String> highPriorityConfig)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Subject to changes due to #51209
    • configProvider

      public DevServicesResultBuildItem.OwnedServiceBuilder<T> configProvider(Map<String,Function<T,String>> applicationConfigProvider)
      Provides config to inject into the config system. If you've got values that don't change, use config(Map), and if you've got values that you'll only know after starting the container, use configProvider() and provide a map of name->lambda. The key in the map is the name of a config property which is being injected.

      Note that if a subclass of Startable is passed in on startable(Supplier), that same subclass will be used in the function. This avoids the need to cast.

      Optional, but will be important in most cases.

      Parameters:
      applicationConfigProvider - a map with config keys on the left side and lambdas on the right
      Returns:
      the builder, for chaining
    • build