Interface StartupCondition


public interface StartupCondition
Pluggable gate evaluated repeatedly before CamelContext finishes starting, allowing startup to be paused until an external prerequisite is satisfied.

Camel polls each registered StartupCondition during the startup sequence. If canContinue(CamelContext) returns false, startup waits and retries. If the condition is never satisfied within the configured timeout the context aborts startup. Multiple conditions can be registered; all must be satisfied for startup to proceed.

Typical use cases include waiting for a readiness probe to pass, a required file or directory to appear, an environment variable to be set, or a remote service to become reachable.

Since:
4.9
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canContinue(CamelContext camelContext)
    Checks if the condition is accepted
    default @Nullable String
    Optional logging message to log if condition was not meet.
    default String
    The name of condition used for logging purposes.
    default @Nullable String
    Optional logging message to log before waiting for the condition
  • Method Details

    • getName

      default String getName()
      The name of condition used for logging purposes.
    • getWaitMessage

      default @Nullable String getWaitMessage()
      Optional logging message to log before waiting for the condition
    • getFailureMessage

      default @Nullable String getFailureMessage()
      Optional logging message to log if condition was not meet.
    • canContinue

      boolean canContinue(CamelContext camelContext) throws Exception
      Checks if the condition is accepted
      Parameters:
      camelContext - the Camel context (is not fully initialized)
      Returns:
      true to continue, false to stop and fail.
      Throws:
      Exception