Interface ExtendedCamelContext


public interface ExtendedCamelContext
Extended CamelContext which contains the methods and APIs that are not primary intended for Camel end users but for SPI, custom components, or more advanced used-cases with Camel.
  • Method Details

    • setName

      void setName(String name)
      Sets the name (id) of this context.

      This operation is mostly only used by different Camel runtimes such as camel-spring, camel-cdi, camel-spring-boot etc. Important: Setting the name should only be set before CamelContext is started.

      Parameters:
      name - the name
    • getName

      default String getName()
    • setDescription

      void setDescription(String description)
      Sets the description of this Camel application.
    • getDescription

      default String getDescription()
    • setRegistry

      void setRegistry(Registry registry)
      Sets the registry Camel should use for looking up beans by name or type.

      This operation is mostly only used by different Camel runtimes such as camel-spring, camel-cdi, camel-spring-boot etc. Important: Setting the registry should only be set before CamelContext is started.

      Parameters:
      registry - the registry such as DefaultRegistry or
    • getRegistry

      default Registry getRegistry()
    • setupRoutes

      void setupRoutes(boolean done)
      Method to signal to CamelContext that the process to initialize setup routes is in progress.
      Parameters:
      done - false to start the process, call again with true to signal its done.
      See Also:
    • isSetupRoutes

      boolean isSetupRoutes()
      Indicates whether current thread is setting up route(s) as part of starting Camel.

      This can be useful to know by LifecycleStrategy or the likes, in case they need to react differently.

      As the startup procedure of CamelContext is slightly different when using plain Java versus camel-spring-xml or camel-blueprint, then we need to know when spring/blueprint are setting up the routes, which can happen after the CamelContext itself is in started state, due the asynchronous event nature of especially blueprint.

      Returns:
      true if current thread is setting up route(s), or false if not.
    • registerEndpointCallback

      void registerEndpointCallback(EndpointStrategy strategy)
      Registers a callback to allow you to do custom logic when an Endpoint is about to be registered to the EndpointRegistry.

      When a callback is registered it will be executed on the already registered endpoints allowing you to catch-up

      Parameters:
      strategy - callback to be invoked
    • getPrototypeEndpoint

      Endpoint getPrototypeEndpoint(String uri)
      Resolves the given name to an Endpoint of the specified type (scope is prototype). If the name has a singleton endpoint registered, then the singleton is returned. Otherwise, a new Endpoint is created. The endpoint is NOT registered in the EndpointRegistry as its prototype scoped, and therefore expected to be short lived and discarded after use (you must stop and shutdown the endpoint when no longer in use).
      Parameters:
      uri - the URI of the endpoint
      Returns:
      the endpoint
      See Also:
    • getPrototypeEndpoint

      Endpoint getPrototypeEndpoint(NormalizedEndpointUri uri)
      Resolves the given name to an Endpoint of the specified type (scope is prototype). If the name has a singleton endpoint registered, then the singleton is returned. Otherwise, a new Endpoint is created. The endpoint is NOT registered in the EndpointRegistry as its prototype scoped, and therefore expected to be short lived and discarded after use (you must stop and shutdown the endpoint when no longer in use).
      Parameters:
      uri - the URI of the endpoint
      Returns:
      the endpoint
      See Also:
    • hasEndpoint

      Endpoint hasEndpoint(NormalizedEndpointUri uri)
      Is the given endpoint already registered in the EndpointRegistry
      Parameters:
      uri - the URI of the endpoint
      Returns:
      the registered endpoint or null if not registered
    • getEndpoint

      Endpoint getEndpoint(NormalizedEndpointUri uri)
      Resolves the given name to an Endpoint of the specified type. If the name has a singleton endpoint registered, then the singleton is returned. Otherwise, a new Endpoint is created and registered in the EndpointRegistry.
      Parameters:
      uri - the URI of the endpoint
      Returns:
      the endpoint
      See Also:
    • getEndpoint

      Endpoint getEndpoint(NormalizedEndpointUri uri, Map<String,Object> parameters)
      Resolves the given name to an Endpoint of the specified type. If the name has a singleton endpoint registered, then the singleton is returned. Otherwise, a new Endpoint is created and registered in the EndpointRegistry.
      Parameters:
      uri - the URI of the endpoint
      parameters - the parameters to customize the endpoint
      Returns:
      the endpoint
      See Also:
    • normalizeUri

      NormalizedEndpointUri normalizeUri(String uri)
      Normalizes the given uri.
      Parameters:
      uri - the uri
      Returns:
      a normalized uri
    • getRouteStartupOrder

      List<RouteStartupOrder> getRouteStartupOrder()
      Returns the order in which the route inputs was started.

      The order may not be according to the startupOrder defined on the route. For example a route could be started manually later, or new routes added at runtime.

      Returns:
      a list in the order how routes was started
    • addBootstrap

      void addBootstrap(BootstrapCloseable bootstrap)
      Adds a BootstrapCloseable task.
    • getServices

      List<Service> getServices()
      Returns an unmodifiable list of the services registered currently in this CamelContext.
    • getExchangeFactory

      ExchangeFactory getExchangeFactory()
      Gets the exchange factory to use.
    • setExchangeFactory

      void setExchangeFactory(ExchangeFactory exchangeFactory)
      Sets a custom exchange factory to use.
    • getExchangeFactoryManager

      ExchangeFactoryManager getExchangeFactoryManager()
      Gets the exchange factory manager to use.
    • setExchangeFactoryManager

      void setExchangeFactoryManager(ExchangeFactoryManager exchangeFactoryManager)
      Sets a custom exchange factory manager to use.
    • getProcessorExchangeFactory

      ProcessorExchangeFactory getProcessorExchangeFactory()
      Gets the processor exchange factory to use.
    • setProcessorExchangeFactory

      void setProcessorExchangeFactory(ProcessorExchangeFactory processorExchangeFactory)
      Sets a custom processor exchange factory to use.
    • getManagementMBeanAssembler

      ManagementMBeanAssembler getManagementMBeanAssembler()
      Returns the management mbean assembler
      Returns:
      the mbean assembler
    • getErrorHandlerFactory

      ErrorHandlerFactory getErrorHandlerFactory()
      Gets the default error handler builder which is inherited by the routes
      Returns:
      the builder
    • setErrorHandlerFactory

      void setErrorHandlerFactory(ErrorHandlerFactory errorHandlerFactory)
      Sets the default error handler builder which is inherited by the routes
      Parameters:
      errorHandlerFactory - the builder
    • getDefaultFactoryFinder

      FactoryFinder getDefaultFactoryFinder()
      Gets the default FactoryFinder which will be used for the loading the factory class from META-INF
      Returns:
      the default factory finder
      See Also:
    • setDefaultFactoryFinder

      void setDefaultFactoryFinder(FactoryFinder factoryFinder)
      Sets the default FactoryFinder which will be used for the loading the factory class from META-INF
    • getBootstrapFactoryFinder

      FactoryFinder getBootstrapFactoryFinder()
      Gets the bootstrap FactoryFinder which will be used for the loading the factory class from META-INF. This bootstrap factory finder is only intended to be used during bootstrap (starting) CamelContext.
      Returns:
      the bootstrap factory finder
      See Also:
    • setBootstrapFactoryFinder

      void setBootstrapFactoryFinder(FactoryFinder factoryFinder)
      Sets the bootstrap FactoryFinder which will be used for the loading the factory class from META-INF. This bootstrap factory finder is only intended to be used during bootstrap (starting) CamelContext.
      See Also:
    • getBootstrapFactoryFinder

      FactoryFinder getBootstrapFactoryFinder(String path)
      Gets the bootstrap FactoryFinder which will be used for the loading the factory class from META-INF in the given path. This bootstrap factory finder is only intended to be used during bootstrap (starting) CamelContext.
      Parameters:
      path - the META-INF path
      Returns:
      the bootstrap factory finder
      See Also:
    • getFactoryFinder

      FactoryFinder getFactoryFinder(String path)
      Gets the FactoryFinder which will be used for the loading the factory class from META-INF in the given path
      Parameters:
      path - the META-INF path
      Returns:
      the factory finder
    • addInterceptStrategy

      void addInterceptStrategy(InterceptStrategy interceptStrategy)
      Adds the given interceptor strategy
      Parameters:
      interceptStrategy - the strategy
    • getInterceptStrategies

      List<InterceptStrategy> getInterceptStrategies()
      Gets the interceptor strategies
      Returns:
      the list of current interceptor strategies
    • setupManagement

      void setupManagement(Map<String,Object> options)
      Setup management according to whether JMX is enabled or disabled.
      Parameters:
      options - optional parameters to configure ManagementAgent.
    • getLogListeners

      Set<LogListener> getLogListeners()
      Gets a list of LogListener (can be null if empty).
    • addLogListener

      void addLogListener(LogListener listener)
      Adds a LogListener.
    • getHeadersMapFactory

      HeadersMapFactory getHeadersMapFactory()
      Gets the HeadersMapFactory to use.
    • setHeadersMapFactory

      void setHeadersMapFactory(HeadersMapFactory factory)
      Sets a custom HeadersMapFactory to be used.
    • getReactiveExecutor

      ReactiveExecutor getReactiveExecutor()
      Gets the ReactiveExecutor to use.
    • setReactiveExecutor

      void setReactiveExecutor(ReactiveExecutor reactiveExecutor)
      Sets a custom ReactiveExecutor to be used.
    • isEventNotificationApplicable

      boolean isEventNotificationApplicable()
      Whether exchange event notification is applicable (possible). This API is used internally in Camel as optimization. This is only for exchange events as this allows Camel to optimize to avoid preparing exchange events if there are no event listeners that are listening for exchange events.
    • setEventNotificationApplicable

      void setEventNotificationApplicable(boolean eventNotificationApplicable)
      Used as internal optimization in Camel to flag whether exchange event notification is applicable or not. This is only for exchange events as this allows Camel to optimize to avoid preparing exchange events if there are no event listeners that are listening for exchange events.
    • getInternalRouteController

      RouteController getInternalRouteController()
      Internal RouteController that are only used internally by Camel to perform basic route operations. Do not use this as end user.
    • getEndpointUriFactory

      EndpointUriFactory getEndpointUriFactory(String scheme)
      Gets the EndpointUriFactory for the given component name.
    • getRuntimeCamelCatalog

      @Deprecated default RuntimeCamelCatalog getRuntimeCamelCatalog()
      Deprecated.
      Gets the RuntimeCamelCatalog if available on the classpath.
    • getStartupStepRecorder

      StartupStepRecorder getStartupStepRecorder()
      Gets the StartupStepRecorder to use.
    • setStartupStepRecorder

      void setStartupStepRecorder(StartupStepRecorder startupStepRecorder)
      Sets the StartupStepRecorder to use.
    • addRoute

      void addRoute(Route route)
      Internal API for adding routes. Do not use this as end user.
    • removeRoute

      void removeRoute(Route route)
      Internal API for removing routes. Do not use this as end user.
    • createErrorHandler

      Processor createErrorHandler(Route route, Processor processor) throws Exception
      Internal API for creating error handler. Do not use this as end user.
      Throws:
      Exception
    • disposeModel

      void disposeModel()
      Danger!!! This will dispose the route model from the CamelContext which is used for lightweight mode. This means afterwards no new routes can be dynamically added. Any operations on the org.apache.camel.model.ModelCamelContext will return null or be a noop operation.
    • getTestExcludeRoutes

      String getTestExcludeRoutes()
      Used during unit-testing where it is possible to specify a set of routes to exclude from discovery
    • resolvePropertyPlaceholders

      String resolvePropertyPlaceholders(String text, boolean keepUnresolvedOptional)
      Parses the given text and resolve any property placeholders - using {{key}}.

      Important: If resolving placeholders on an endpoint uri, then you SHOULD use EndpointHelper#resolveEndpointUriPropertyPlaceholders instead.

      Parameters:
      text - the text such as an endpoint uri or the likes
      keepUnresolvedOptional - whether to keep placeholders that are optional and was unresolved
      Returns:
      the text with resolved property placeholders
      Throws:
      IllegalArgumentException - is thrown if property placeholders was used and there was an error resolving them
    • getBasePackageScan

      String getBasePackageScan()
      Package name to use as base (offset) for classpath scanning of RouteBuilder, TypeConverter, CamelConfiguration classes, and also classes annotated with Converter, or BindToRegistry.
      Returns:
      the base package name (can be null if not configured)
    • setBasePackageScan

      void setBasePackageScan(String basePackageScan)
      Package name to use as base (offset) for classpath scanning of RouteBuilder, TypeConverter, CamelConfiguration classes, and also classes annotated with Converter, or BindToRegistry.
      Parameters:
      basePackageScan - the base package name
    • getStatusPhase

      byte getStatusPhase()
      The CamelContext have additional phases that are not defined in ServiceStatus and this method provides the phase ordinal value.
    • getContextPlugin

      <T> T getContextPlugin(Class<T> type)
      Gets a plugin of the given type.
      Parameters:
      type - the type of the extension
      Returns:
      the extension, or null if no extension has been installed.
    • addContextPlugin

      <T> void addContextPlugin(Class<T> type, T module)
      Allows installation of custom plugins to the Camel context.
      Parameters:
      type - the type of the extension
      module - the instance of the extension
    • lazyAddContextPlugin

      <T> void lazyAddContextPlugin(Class<T> type, Supplier<T> module)
      Allows lazy installation of custom plugins to the Camel context.
      Parameters:
      type - the type of the extension
      module - the instance of the extension