Interface StartupConditionStrategy

All Superinterfaces:
AutoCloseable, Service, StaticService

public interface StartupConditionStrategy extends StaticService
Strategy that runs StartupCondition checks during startup to decide whether Camel may start, optionally waiting until the conditions are satisfied.

Conditions are registered via addStartupCondition(StartupCondition) (or by class name) and evaluated by checkStartupConditions(); the strategy polls at a configurable interval up to a timeout, and on timeout either fails, stops, or ignores. Useful to delay startup until an external dependency (database, broker, etc.) is reachable.

Since:
4.9
See Also:
  • Method Details

    • isEnabled

      boolean isEnabled()
      To enable or disable startup checks
    • setEnabled

      void setEnabled(boolean enabled)
      To enable or disable startup checks
    • setInterval

      void setInterval(int interval)
      Interval in millis between checking startup conditions
    • getInterval

      int getInterval()
      Interval in millis between checking startup conditions
    • setTimeout

      void setTimeout(int timeout)
      Total timeout in millis when performing startup checks.
    • getTimeout

      int getTimeout()
      Total timeout in millis when performing startup checks.
    • getOnTimeout

      String getOnTimeout()
      What action, to do on timeout. fail = do not startup, and throw an exception causing camel to fail stop = do not startup, and stop camel ignore = log a WARN and continue to startup
    • setOnTimeout

      void setOnTimeout(String onTimeout)
      What action, to do on timeout. fail = do not startup, and throw an exception causing camel to fail stop = do not startup, and stop camel ignore = log a WARN and continue to startup
    • addStartupCondition

      void addStartupCondition(StartupCondition startupCondition)
      Adds a custom StartupCondition check to be performed.
    • addStartupConditions

      void addStartupConditions(String classNames)
      A list of custom class names (FQN) for StartupCondition classes. Multiple classes can be separated by comma.
    • getStartupConditions

      List<StartupCondition> getStartupConditions()
      Lists all the StartupCondition.
    • checkStartupConditions

      void checkStartupConditions() throws Exception
      Checks all StartupCondition whether they are satisfied. If everything is okay, then this method returns, otherwise if a condition is failing then an exception is thrown.
      Throws:
      Exception