Interface ContextServicePlugin


public interface ContextServicePlugin
A plugin interface that allows third-party components to perform initialization tasks when a CamelContext is being configured and started.

Implementations of this interface are automatically discovered and loaded via the Java ServiceLoader mechanism. To register a plugin, create a service provider configuration file at META-INF/services/org.apache.camel.spi.ContextServicePlugin containing the fully qualified class name of your implementation.

Common use cases include:

  • Registering beans in the Camel registry
  • Adding event notifiers for monitoring
  • Configuring global interceptors
  • Setting up custom type converters

Example Usage:

 
 public class MyContextServicePlugin implements ContextServicePlugin {
     @Override
     public void load(CamelContext camelContext) {
         // Register a bean in the registry
         camelContext.getRegistry().bind("myBean", new MyBean());

         // Add an event notifier
         camelContext.getManagementStrategy().addEventNotifier(new MyEventNotifier());
     }
 }
 
 
See Also:
  • invalid reference
    org.apache.camel.impl.engine.DefaultContextServiceLoaderPlugin
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    load(CamelContext camelContext)
    Called during CamelContext initialization to allow the plugin to configure or customize the context.
  • Method Details

    • load

      void load(CamelContext camelContext)
      Called during CamelContext initialization to allow the plugin to configure or customize the context.

      This method is invoked after the CamelContext has been created but before routes are started. Implementations should perform any necessary setup operations such as registering beans, adding event notifiers, or configuring global settings.

      Parameters:
      camelContext - the CamelContext being initialized, never null