Interface ManagementNameStrategy


public interface ManagementNameStrategy
Strategy for assigning the name segment of the ObjectName for a managed CamelContext.

A strategy is needed because multiple CamelContext instances can run in the same JVM and share the same JMX MBeanServer. The strategy either computes a unique name automatically (using an incrementing counter or the context name) or enforces a fixed name so the JMX key remains stable across restarts.

The naming pattern supports at least the following tokens:

  • #camelId# - the Camel context id (its configured name)
  • #name# - same as #camelId#
  • #counter# - an incrementing counter that guarantees uniqueness

This strategy controls only the name= key within the domain; the full ObjectName construction (including all other key-value pairs) is the responsibility of ManagementObjectNameStrategy.

See JMX in the Camel user manual.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the name
    @Nullable String
    Gets the custom name pattern.
    Gets the next calculated name, if this strategy is not using fixed names.
    boolean
    Whether the name will be fixed, or allow re-calculation such as by using an unique counter.
    resolveManagementName(String pattern, String name, boolean invalidCheck)
    Creates a new management name with the given pattern.
    void
    Sets a custom name pattern, which will be used instead of any default patterns.
  • Method Details

    • getNamePattern

      @Nullable String getNamePattern()
      Gets the custom name pattern.
      Returns:
      the custom name pattern, or null if using the default pattern strategy.
    • setNamePattern

      void setNamePattern(String pattern)
      Sets a custom name pattern, which will be used instead of any default patterns.
      Parameters:
      pattern - a custom name pattern.
    • getName

      String getName()
      Gets the name

      The isFixedName() determines if the name can be re-calculated such as when using a counter, or the name is always fixed.

      Returns:
      the name.
    • getNextName

      String getNextName()
      Gets the next calculated name, if this strategy is not using fixed names.

      The isFixedName() determines if the name can be re-calculated such as when using a counter, or the name is always fixed.

      Returns:
      the next name
    • isFixedName

      boolean isFixedName()
      Whether the name will be fixed, or allow re-calculation such as by using an unique counter.
      Returns:
      true for fixed names, false for names which can re-calculated
    • resolveManagementName

      String resolveManagementName(String pattern, String name, boolean invalidCheck)
      Creates a new management name with the given pattern.
      Parameters:
      pattern - the pattern
      name - the name
      invalidCheck - whether to check for invalid pattern
      Returns:
      the management name
      Throws:
      IllegalArgumentException - if the pattern or name is invalid or empty