Main

Since Camel 3.0

This module is used for running Camel standalone via a main class extended from camel-main.

Configuration options

When running Camel via camel-main you can configure Camel in the application.properties file.

The following tables lists all the options:

Camel Main configurations

The camel.main supports 103 options, which are listed below.

Name Description Default Type

camel.main.allowUseOriginal​Message

Sets whether to allow access to the original message from Camel’s error handler, or from org.apache.camel.spi.UnitOfWork.getOriginalInMessage(). Turning this off can optimize performance, as defensive copy of the original message is not needed. Default is false.

false

boolean

camel.main.autoConfiguration​Enabled

Whether auto configuration of components, dataformats, languages is enabled or not. When enabled the configuration parameters are loaded from the properties component. You can prefix the parameters in the properties file with: - camel.component.name.option1=value1 - camel.component.name.option2=value2 - camel.dataformat.name.option1=value1 - camel.dataformat.name.option2=value2 - camel.language.name.option1=value1 - camel.language.name.option2=value2 Where name is the name of the component, dataformat or language such as seda,direct,jaxb. The auto configuration also works for any options on components that is a complex type (not standard Java type) and there has been an explicit single bean instance registered to the Camel registry via the org.apache.camel.spi.Registry#bind(String,Object) method or by using the org.apache.camel.BindToRegistry annotation style. This option is default enabled.

true

boolean

camel.main.autoConfiguration​EnvironmentVariablesEnabled

Whether auto configuration should include OS environment variables as well. When enabled this allows to overrule any configuration using an OS environment variable. For example to set a shutdown timeout of 5 seconds: CAMEL_MAIN_SHUTDOWNTIMEOUT=5. This option is default enabled.

true

boolean

camel.main.autoConfiguration​FailFast

Whether auto configuration should fail fast when configuring one ore more properties fails for whatever reason such as a invalid property name, etc. This option is default enabled.

true

boolean

camel.main.autoConfiguration​LogSummary

Whether auto configuration should log a summary with the configured properties. This option is default enabled.

true

boolean

camel.main.autoConfiguration​SystemPropertiesEnabled

Whether auto configuration should include JVM system properties as well. When enabled this allows to overrule any configuration using a JVM system property. For example to set a shutdown timeout of 5 seconds: -D camel.main.shutdown-timeout=5. Note that JVM system properties take precedence over OS environment variables. This option is default enabled.

true

boolean

camel.main.autoStartup

Sets whether the object should automatically start when Camel starts. Important: Currently only routes can be disabled, as CamelContext’s are always started. Note: When setting auto startup false on CamelContext then that takes precedence and no routes are started. You would need to start CamelContext explicit using the org.apache.camel.CamelContext.start() method, to start the context, and then you would need to start the routes manually using CamelContext.getRouteController().startRoute(String). Default is true to always start up.

true

boolean

camel.main.autowiredEnabled

Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. Default is true.

true

boolean

camel.main.backlogTracing

Sets whether backlog tracing is enabled or not. Default is false.

false

boolean

camel.main.beanIntrospection​ExtendedStatistics

Sets whether bean introspection uses extended statistics. The default is false.

false

boolean

camel.main.beanIntrospection​LoggingLevel

Sets the logging level used by bean introspection, logging activity of its usage. The default is TRACE.

LoggingLevel

camel.main.beanPostProcessor​Enabled

Can be used to turn off bean post processing. Be careful to turn this off, as this means that beans that use Camel annotations such as org.apache.camel.EndpointInject , org.apache.camel.ProducerTemplate , org.apache.camel.Produce , org.apache.camel.Consume etc will not be injected and in use. Turning this off should only be done if you are sure you do not use any of these Camel features. Not all runtimes allow turning this off (such as camel-blueprint or camel-cdi with XML). The default value is true (enabled).

true

boolean

camel.main.caseInsensitive​Headers

Whether to use case sensitive or insensitive headers. Important: When using case sensitive (this is set to false). Then the map is case sensitive which means headers such as content-type and Content-Type are two different keys which can be a problem for some protocols such as HTTP based, which rely on case insensitive headers. However case sensitive implementations can yield faster performance. Therefore use case sensitive implementation with care. Default is true.

true

boolean

camel.main.configuration​Classes

Sets classes names that will be used to configure the camel context as example by providing custom beans through org.apache.camel.BindToRegistry annotation.

String

camel.main.configurations

Sets the configuration objects used to configure the camel context.

List

camel.main.consumerTemplate​CacheSize

Consumer template endpoints cache size.

1000

int

camel.main.dumpRoutes

If dumping is enabled then Camel will during startup dump all loaded routes (incl rests and route templates) represented as XML DSL into the log. This is intended for trouble shooting or to assist during development. Sensitive information that may be configured in the route endpoints could potentially be included in the dump output and is therefore not recommended to be used for production usage. This requires to have camel-xml-jaxb on the classpath to be able to dump the routes as XML.

false

boolean

camel.main.durationHitExitCode

Sets the exit code for the application if duration was hit

int

camel.main.durationMaxAction

Controls whether the Camel application should shutdown the JVM, or stop all routes, when duration max is triggered.

shutdown

String

camel.main.durationMaxIdle​Seconds

To specify for how long time in seconds Camel can be idle before automatic terminating the JVM. You can use this to run Camel for a short while.

int

camel.main.durationMaxMessages

To specify how many messages to process by Camel before automatic terminating the JVM. You can use this to run Camel for a short while.

int

camel.main.durationMaxSeconds

To specify for how long time in seconds to keep running the JVM before automatic terminating the JVM. You can use this to run Camel for a short while.

int

camel.main.eagerClassloading

Whether to eager load a common set of Camel classes that would otherwise first be loaded on processing the first message. By eager loading these classes then the JVM has already loaded the classes during build phase, which allows Camel to process the first message faster.

false

boolean

camel.main.endpointBridgeError​Handler

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN/ERROR level and ignored. The default value is false.

false

boolean

camel.main.endpointLazyStart​Producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. The default value is false.

false

boolean

camel.main.endpointRuntime​StatisticsEnabled

Sets whether endpoint runtime statistics is enabled (gathers runtime usage of each incoming and outgoing endpoints). The default value is false.

false

boolean

camel.main.exchangeFactory

Controls whether to pool (reuse) exchanges or create new exchanges (prototype). Using pooled will reduce JVM garbage collection overhead by avoiding to re-create Exchange instances per message each consumer receives. The default is prototype mode.

default

String

camel.main.exchangeFactory​Capacity

The capacity the pool (for each consumer) uses for storing exchanges. The default capacity is 100.

100

int

camel.main.exchangeFactory​StatisticsEnabled

Configures whether statistics is enabled on exchange factory.

false

boolean

camel.main.fileConfigurations

Directory to load additional configuration files that contains configuration values that takes precedence over any other configuration. This can be used to refer to files that may have secret configuration that has been mounted on the file system for containers. You can specify a pattern to load from sub directories and a name pattern such as /var/app/secret/.properties, multiple directories can be separated by comma.

String

camel.main.globalOptions

Sets global options that can be referenced in the camel context Important: This has nothing to do with property placeholders, and is just a plain set of key/value pairs which are used to configure global options on CamelContext, such as a maximum debug logging length etc.

Map

camel.main.inflightRepository​BrowseEnabled

Sets whether the inflight repository should allow browsing each inflight exchange. This is by default disabled as there is a very slight performance overhead when enabled.

false

boolean

camel.main.javaRoutesExclude​Pattern

Used for exclusive filtering RouteBuilder classes which are collected from the registry or via classpath scanning. The exclusive filtering takes precedence over inclusive filtering. The pattern is using Ant-path style pattern. Multiple patterns can be specified separated by comma. For example to exclude all classes starting with Bar use: **/Bar* To exclude all routes form a specific package use: com/mycompany/bar/* To exclude all routes form a specific package and its sub-packages use double wildcards: com/mycompany/bar/** And to exclude all routes from two specific packages use: com/mycompany/bar/*,com/mycompany/stuff/*

String

camel.main.javaRoutesInclude​Pattern

Used for inclusive filtering RouteBuilder classes which are collected from the registry or via classpath scanning. The exclusive filtering takes precedence over inclusive filtering. The pattern is using Ant-path style pattern. Multiple patterns can be specified separated by comma. Multiple patterns can be specified separated by comma. For example to include all classes starting with Foo use: **/Foo To include all routes form a specific package use: com/mycompany/foo/* To include all routes form a specific package and its sub-packages use double wildcards: com/mycompany/foo/** And to include all routes from two specific packages use: com/mycompany/foo/*,com/mycompany/stuff/*

String

camel.main.jmxEnabled

Enable JMX in your Camel application.

true

boolean

camel.main.jmxManagementName​Pattern

The naming pattern for creating the CamelContext JMX management name. The default pattern is name

name

String

camel.main.jmxManagement​StatisticsLevel

Sets the JMX statistics level, the level can be set to Extended to gather additional information The default value is Default.

Default

ManagementStatisticsLevel

camel.main.lightweight

Configure the context to be lightweight. This will trigger some optimizations and memory reduction options. Lightweight context have some limitations. At this moment, dynamic endpoint destinations are not supported.

false

boolean

camel.main.loadHealthChecks

Whether to load custom health checks by scanning classpath.

false

boolean

camel.main.loadTypeConverters

Whether to load custom type converters by scanning classpath. This is used for backwards compatibility with Camel 2.x. Its recommended to migrate to use fast type converter loading by setting Converter(loader = true) on your custom type converter classes.

false

boolean

camel.main.logDebugMaxChars

Is used to limit the maximum length of the logging Camel message bodies. If the message body is longer than the limit, the log message is clipped. Use -1 to have unlimited length. Use for example 1000 to log at most 1000 characters.

int

camel.main.logExhaustedMessage​Body

Sets whether to log exhausted message body with message history. Default is false.

false

boolean

camel.main.logMask

Sets whether log mask is enabled or not. Default is false.

false

boolean

camel.main.mdcLoggingKeys​Pattern

Sets the pattern used for determine which custom MDC keys to propagate during message routing when the routing engine continues routing asynchronously for the given message. Setting this pattern to will propagate all custom keys. Or setting the pattern to foo,bar will propagate any keys starting with either foo or bar. Notice that a set of standard Camel MDC keys are always propagated which starts with camel. as key name. The match rules are applied in this order (case insensitive): 1. exact match, returns true 2. wildcard match (pattern ends with a and the name starts with the pattern), returns true 3. regular expression match, returns true 4. otherwise returns false

String

camel.main.messageHistory

Sets whether message history is enabled or not. Default is false.

false

boolean

camel.main.name

Sets the name of the CamelContext.

String

camel.main.packageScanRoute​Builders

Sets package names for scanning for org.apache.camel.builder.RouteBuilder classes as candidates to be included. If you are using Spring Boot then its instead recommended to use Spring Boots component scanning and annotate your route builder classes with Component. In other words only use this for Camel Main in standalone mode.

String

camel.main.producerTemplate​CacheSize

Producer template endpoints cache size.

1000

int

camel.main.routeControllerBack​OffDelay

Backoff delay in millis when restarting a route that failed to startup.

long

camel.main.routeControllerBack​OffMaxAttempts

Backoff maximum number of attempts to restart a route that failed to startup. When this threshold has been exceeded then the controller will give up attempting to restart the route, and the route will remain as stopped.

long

camel.main.routeControllerBack​OffMaxDelay

Backoff maximum delay in millis when restarting a route that failed to startup.

long

camel.main.routeControllerBack​OffMaxElapsedTime

Backoff maximum elapsed time in millis, after which the backoff should be considered exhausted and no more attempts should be made.

long

camel.main.routeControllerBack​OffMultiplier

Backoff multiplier to use for exponential backoff. This is used to extend the delay between restart attempts.

double

camel.main.routeController​ExcludeRoutes

Pattern for filtering routes to be excluded as supervised. The pattern is matching on route id, and endpoint uri for the route. Multiple patterns can be separated by comma. For example to exclude all JMS routes, you can say jms:. And to exclude routes with specific route ids mySpecialRoute,myOtherSpecialRoute. The pattern supports wildcards and uses the matcher from org.apache.camel.support.PatternHelper#matchPattern.

String

camel.main.routeController​IncludeRoutes

Pattern for filtering routes to be included as supervised. The pattern is matching on route id, and endpoint uri for the route. Multiple patterns can be separated by comma. For example to include all kafka routes, you can say kafka:. And to include routes with specific route ids myRoute,myOtherRoute. The pattern supports wildcards and uses the matcher from org.apache.camel.support.PatternHelper#matchPattern.

String

camel.main.routeController​InitialDelay

Initial delay in milli seconds before the route controller starts, after CamelContext has been started.

long

camel.main.routeController​LoggingLevel

Sets the logging level used for logging route activity (such as starting and stopping routes). The default logging level is DEBUG.

DEBUG

LoggingLevel

camel.main.routeController​SuperviseEnabled

To enable using supervising route controller which allows Camel to startup and then the controller takes care of starting the routes in a safe manner. This can be used when you want to startup Camel despite a route may otherwise fail fast during startup and cause Camel to fail to startup as well. By delegating the route startup to the supervising route controller then its manages the startup using a background thread. The controller allows to be configured with various settings to attempt to restart failing routes.

false

boolean

camel.main.routeController​ThreadPoolSize

The number of threads used by the route controller scheduled thread pool that are used for restarting routes. The pool uses 1 thread by default, but you can increase this to allow the controller to concurrently attempt to restart multiple routes in case more than one route has problems starting.

int

camel.main.routeController​UnhealthyOnExhausted

Whether to mark the route as unhealthy (down) when all restarting attempts (backoff) have failed and the route is not successfully started and the route manager is giving up. Setting this to true allows health checks to know about this and can report the Camel application as DOWN. The default is false.

false

boolean

camel.main.routeFilterExclude​Pattern

Used for filtering routes routes matching the given pattern, which follows the following rules: - Match by route id - Match by route input endpoint uri The matching is using exact match, by wildcard and regular expression as documented by PatternHelper#matchPattern(String,String) . For example to only include routes which starts with foo in their route id’s, use: include=foo* And to exclude routes which starts from JMS endpoints, use: exclude=jms:* Multiple patterns can be separated by comma, for example to exclude both foo and bar routes, use: exclude=foo*,bar* Exclude takes precedence over include.

String

camel.main.routeFilterInclude​Pattern

Used for filtering routes matching the given pattern, which follows the following rules: - Match by route id - Match by route input endpoint uri The matching is using exact match, by wildcard and regular expression as documented by PatternHelper#matchPattern(String,String) . For example to only include routes which starts with foo in their route id’s, use: include=foo* And to exclude routes which starts from JMS endpoints, use: exclude=jms:* Multiple patterns can be separated by comma, for example to exclude both foo and bar routes, use: exclude=foo*,bar* Exclude takes precedence over include.

String

camel.main.routesBuilder​Classes

Sets classes names that implement RoutesBuilder .

String

camel.main.routesBuilders

Sets the RoutesBuilder instances.

List

camel.main.routesCollector​Enabled

Whether the routes collector is enabled or not. When enabled Camel will auto-discover routes (RouteBuilder instances from the registry and also load additional routes from the file system). The routes collector is default enabled.

true

boolean

camel.main.routesExclude​Pattern

Used for exclusive filtering of routes from directories. The exclusive filtering takes precedence over inclusive filtering. The pattern is using Ant-path style pattern. Multiple patterns can be specified separated by comma, as example, to exclude all the routes from a directory whose name contains foo use: **/foo.

String

camel.main.routesInclude​Pattern

Used for inclusive filtering of routes from directories. The exclusive filtering takes precedence over inclusive filtering. The pattern is using Ant-path style pattern. Multiple patterns can be specified separated by comma, as example, to include all the routes from a directory whose name contains foo use: **/foo.

classpath:camel/,classpath:camel-template/,classpath:camel-rest/*

String

camel.main.routesReload​Directory

Directory to scan for route changes. Camel cannot scan the classpath, so this must be configured to a file directory. Development with Maven as build tool, you can configure the directory to be src/main/resources to scan for Camel routes in XML or YAML files.

src/main/resources/camel

String

camel.main.routesReload​DirectoryRecursive

Whether the directory to scan should include sub directories. Depending on the number of sub directories, then this can cause the JVM to startup slower as Camel uses the JDK file-watch service to scan for file changes.

false

boolean

camel.main.routesReloadEnabled

Used for enabling automatic routes reloading. If enabled then Camel will watch for file changes in the given reload directory, and trigger reloading routes if files are changed.

false

boolean

camel.main.routesReloadPattern

Used for inclusive filtering of routes from directories. Typical used for specifying to accept routes in XML or YAML files, such as .yaml,.xml. Multiple patterns can be specified separated by comma.

String

camel.main.routesReloadRemove​AllRoutes

When reloading routes should all existing routes be stopped and removed. By default, Camel will stop and remove all existing routes before reloading routes. This ensures that only the reloaded routes will be active. If disabled then only routes with the same route id is updated, and any existing routes are continued to run.

true

boolean

camel.main.routesReloadRestart​Duration

Whether to restart max duration when routes are reloaded. For example if max duration is 60 seconds, and a route is reloaded after 25 seconds, then this will restart the count and wait 60 seconds again.

true

boolean

camel.main.shutdownLogInflight​ExchangesOnTimeout

Sets whether to log information about the inflight Exchanges which are still running during a shutdown which didn’t complete without the given timeout. This requires to enable the option inflightRepositoryBrowseEnabled.

true

boolean

camel.main.shutdownNowOn​Timeout

Sets whether to force shutdown of all consumers when a timeout occurred and thus not all consumers was shutdown within that period. You should have good reasons to set this option to false as it means that the routes keep running and is halted abruptly when CamelContext has been shutdown.

true

boolean

camel.main.shutdownRoutesIn​ReverseOrder

Sets whether routes should be shutdown in reverse or the same order as they were started.

true

boolean

camel.main.shutdownSuppress​LoggingOnTimeout

Whether Camel should try to suppress logging during shutdown and timeout was triggered, meaning forced shutdown is happening. And during forced shutdown we want to avoid logging errors/warnings et all in the logs as a side-effect of the forced timeout. Notice the suppress is a best effort as there may still be some logs coming from 3rd party libraries and whatnot, which Camel cannot control. This option is default false.

false

boolean

camel.main.shutdownTimeout

Timeout in seconds to graceful shutdown Camel.

45

int

camel.main.startupRecorder

To use startup recorder for capturing execution time during starting Camel. The recorder can be one of: false (or off), logging, java-flight-recorder (or jfr).

String

camel.main.startupRecorderDir

Directory to store the recording. By default the current directory will be used. Use false to turn off saving recording to disk.

String

camel.main.startupRecorder​Duration

How long time to run the startup recorder. Use 0 (default) to keep the recorder running until the JVM is exited. Use -1 to stop the recorder right after Camel has been started (to only focus on potential Camel startup performance bottlenecks) Use a positive value to keep recording for N seconds. When the recorder is stopped then the recording is auto saved to disk (note: save to disk can be disabled by setting startupRecorderDir to false)

long

camel.main.startupRecorderMax​Depth

To filter our sub steps at a maximum depth. Use -1 for no maximum. Use 0 for no sub steps. Use 1 for max 1 sub step, and so forth. The default is -1.

-1

int

camel.main.startupRecorder​Profile

To use a specific Java Flight Recorder profile configuration, such as default or profile. The default is default.

default

String

camel.main.startupRecorder​Recording

To enable Java Flight Recorder to start a recording and automatic dump the recording to disk after startup is complete. This requires that camel-jfr is on the classpath, and to enable this option.

false

boolean

camel.main.startupSummaryLevel

Controls the level of information logged during startup (and shutdown) of CamelContext.

Default

StartupSummaryLevel

camel.main.streamCachingAny​SpoolRules

Sets whether if just any of the org.apache.camel.spi.StreamCachingStrategy.SpoolRule rules returns true then shouldSpoolCache(long) returns true, to allow spooling to disk. If this option is false, then all the org.apache.camel.spi.StreamCachingStrategy.SpoolRule must return true. The default value is false which means that all the rules must return true.

false

boolean

camel.main.streamCachingBuffer​Size

Sets the stream caching buffer size to use when allocating in-memory buffers used for in-memory stream caches. The default size is 4096.

int

camel.main.streamCaching​Enabled

Sets whether stream caching is enabled or not. Default is false.

false

boolean

camel.main.streamCachingRemove​SpoolDirectoryWhenStopping

Whether to remove stream caching temporary directory when stopping. This option is default true.

true

boolean

camel.main.streamCachingSpool​Cipher

Sets a stream caching cipher name to use when spooling to disk to write with encryption. By default the data is not encrypted.

String

camel.main.streamCachingSpool​Directory

Sets the stream caching spool (temporary) directory to use for overflow and spooling to disk. If no spool directory has been explicit configured, then a temporary directory is created in the java.io.tmpdir directory.

String

camel.main.streamCachingSpool​Threshold

Stream caching threshold in bytes when overflow to disk is activated. The default threshold is 128kb. Use -1 to disable overflow to disk.

long

camel.main.streamCachingSpool​UsedHeapMemoryLimit

Sets what the upper bounds should be when streamCachingSpoolUsedHeapMemoryThreshold is in use.

String

camel.main.streamCachingSpool​UsedHeapMemoryThreshold

Sets a percentage (1-99) of used heap memory threshold to activate stream caching spooling to disk.

int

camel.main.streamCaching​StatisticsEnabled

Sets whether stream caching statistics is enabled.

false

boolean

camel.main.threadNamePattern

Sets the thread name pattern used for creating the full thread name. The default pattern is: Camel (camelId) thread #counter - name Where camelId is the name of the CamelContext. and counter is a unique incrementing counter. and name is the regular thread name. You can also use longName which is the long thread name which can includes endpoint parameters etc.

String

camel.main.tracing

Sets whether tracing is enabled or not. Default is false.

false

boolean

camel.main.tracingPattern

Tracing pattern to match which node EIPs to trace. For example to match all To EIP nodes, use to. The pattern matches by node and route id’s Multiple patterns can be separated by comma.

String

camel.main.tracingStandby

Whether to set tracing on standby. If on standby then the tracer is installed and made available. Then the tracer can be enabled later at runtime via JMX or via Tracer#setEnabled(boolean) .

false

boolean

camel.main.useBreadcrumb

Set whether breadcrumb is enabled. The default value is false.

false

boolean

camel.main.useDataType

Whether to enable using data type on Camel messages. Data type are automatic turned on if one ore more routes has been explicit configured with input and output types. Otherwise data type is default off.

false

boolean

camel.main.useMdcLogging

To turn on MDC logging

false

boolean

camel.main.uuidGenerator

UUID generator to use. default (32 bytes), short (16 bytes), classic (32 bytes or longer), simple (long incrementing counter), off (turned off for exchanges - only intended for performance profiling)

default

String

Camel Thread Pool configurations

The camel.threadpool supports 8 options, which are listed below.

Name Description Default Type

camel.threadpool.allowCore​ThreadTimeOut

Sets default whether to allow core threads to timeout

false

Boolean

camel.threadpool.config

Adds a configuration for a specific thread pool profile (inherits default values)

Map

camel.threadpool.keepAliveTime

Sets the default keep alive time for inactive threads

Long

camel.threadpool.maxPoolSize

Sets the default maximum pool size

Integer

camel.threadpool.maxQueueSize

Sets the default maximum number of tasks in the work queue. Use -1 or an unbounded queue

Integer

camel.threadpool.poolSize

Sets the default core pool size (threads to keep minimum in pool)

Integer

camel.threadpool.rejected​Policy

Sets the default handler for tasks which cannot be executed by the thread pool.

ThreadPoolRejectedPolicy

camel.threadpool.timeUnit

Sets the default time unit used for keep alive time

TimeUnit

Camel Health Check configurations

The camel.health supports 6 options, which are listed below.

Name Description Default Type

camel.health.config

Set additional HealthConfigurationProperties for fine grained configuration of health checks.

Map

camel.health.consumersEnabled

Whether consumers health check is enabled

true

Boolean

camel.health.contextEnabled

Whether context health check is enabled

true

Boolean

camel.health.enabled

Whether health check is enabled globally

true

Boolean

camel.health.registryEnabled

Whether registry health check is enabled

true

Boolean

camel.health.routesEnabled

Whether routes health check is enabled

true

Boolean

Camel Rest-DSL configurations

The camel.rest supports 28 options, which are listed below.

Name Description Default Type

camel.rest.apiComponent

Sets the name of the Camel component to use as the REST API (such as swagger or openapi)

String

camel.rest.apiContextIdPattern

Optional CamelContext id pattern to only allow Rest APIs from rest services within CamelContext’s which name matches the pattern. The pattern name refers to the CamelContext name, to match on the current CamelContext only. For any other value, the pattern uses the rules from org.apache.camel.support.EndpointHelper#matchPattern(String,String)

String

camel.rest.apiContextListing

Sets whether listing of all available CamelContext’s with REST services in the JVM is enabled. If enabled it allows to discover these contexts, if false then only the current CamelContext is in use.

false

boolean

camel.rest.apiContextPath

Sets a leading API context-path the REST API services will be using. This can be used when using components such as camel-servlet where the deployed web application is deployed using a context-path.

String

camel.rest.apiContextRouteId

Sets the route id to use for the route that services the REST API. The route will by default use an auto assigned route id.

String

camel.rest.apiHost

To use a specific hostname for the API documentation (such as swagger or openapi) This can be used to override the generated host with this configured hostname

String

camel.rest.apiProperties

Sets additional options on api level

Map

camel.rest.apiVendorExtension

Whether vendor extension is enabled in the Rest APIs. If enabled then Camel will include additional information as vendor extension (eg keys starting with x-) such as route ids, class names etc. Not all 3rd party API gateways and tools supports vendor-extensions when importing your API docs.

false

boolean

camel.rest.bindingMode

Sets the binding mode to be used by the REST consumer

RestBindingMode.off

RestBindingMode

camel.rest.clientRequest​Validation

Whether to enable validation of the client request to check: 1) Content-Type header matches what the Rest DSL consumes; returns HTTP Status 415 if validation error. 2) Accept header matches what the Rest DSL produces; returns HTTP Status 406 if validation error. 3) Missing required data (query parameters, HTTP headers, body); returns HTTP Status 400 if validation error. 4) Parsing error of the message body (JSon, XML or Auto binding mode must be enabled); returns HTTP Status 400 if validation error.

false

boolean

camel.rest.component

Sets the name of the Camel component to use as the REST consumer

String

camel.rest.componentProperties

Sets additional options on component level

Map

camel.rest.consumerProperties

Sets additional options on consumer level

Map

camel.rest.contextPath

Sets a leading context-path the REST services will be using. This can be used when using components such as camel-servlet where the deployed web application is deployed using a context-path. Or for components such as camel-jetty or camel-netty-http that includes a HTTP server.

String

camel.rest.corsHeaders

Sets the CORS headers to use if CORS has been enabled.

Map

camel.rest.dataFormat​Properties

Sets additional options on data format level

Map

camel.rest.enableCORS

To specify whether to enable CORS which means Camel will automatic include CORS in the HTTP headers in the response. This option is default false

false

boolean

camel.rest.endpointProperties

Sets additional options on endpoint level

Map

camel.rest.host

Sets the hostname to use by the REST consumer

String

camel.rest.hostNameResolver

Sets the resolver to use for resolving hostname

RestHostNameResolver.allLocalIp

RestHostNameResolver

camel.rest.jsonDataFormat

Sets a custom json data format to be used Important: This option is only for setting a custom name of the data format, not to refer to an existing data format instance.

String

camel.rest.port

Sets the port to use by the REST consumer

int

camel.rest.producerApiDoc

Sets the location of the api document (swagger api) the REST producer will use to validate the REST uri and query parameters are valid accordingly to the api document. This requires adding camel-swagger-java to the classpath, and any miss configuration will let Camel fail on startup and report the error(s). The location of the api document is loaded from classpath by default, but you can use file: or http: to refer to resources to load from file or http url.

String

camel.rest.producerComponent

Sets the name of the Camel component to use as the REST producer

String

camel.rest.scheme

Sets the scheme to use by the REST consumer

String

camel.rest.skipBindingOnError​Code

Whether to skip binding output if there is a custom HTTP error code, and instead use the response body as-is. This option is default true.

true

boolean

camel.rest.useXForwardHeaders

Whether to use X-Forward headers to set host etc. for Swagger. This option is default true.

true

boolean

camel.rest.xmlDataFormat

Sets a custom xml data format to be used. Important: This option is only for setting a custom name of the data format, not to refer to an existing data format instance.

String

Fault Tolerance EIP Circuit Breaker configurations

The camel.faulttolerance supports 13 options, which are listed below.

Name Description Default Type

camel.faulttolerance.bulkhead​Enabled

Whether bulkhead is enabled or not on the circuit breaker. Default is false.

false

Boolean

camel.faulttolerance.bulkhead​ExecutorServiceRef

References to a custom thread pool to use when bulkhead is enabled.

String

camel.faulttolerance.bulkhead​MaxConcurrentCalls

Configures the max amount of concurrent calls the bulkhead will support. Default value is 10.

10

Integer

camel.faulttolerance.bulkhead​WaitingTaskQueue

Configures the task queue size for holding waiting tasks to be processed by the bulkhead. Default value is 10.

10

Integer

camel.faulttolerance.circuit​BreakerRef

Refers to an existing io.smallrye.faulttolerance.core.circuit.breaker.CircuitBreaker instance to lookup and use from the registry. When using this, then any other circuit breaker options are not in use.

String

camel.faulttolerance.delay

Control how long the circuit breaker stays open. The value are in seconds and the default is 5 seconds.

5

Long

camel.faulttolerance.failure​Ratio

Configures the failure rate threshold in percentage. If the failure rate is equal or greater than the threshold the CircuitBreaker transitions to open and starts short-circuiting calls. The threshold must be greater than 0 and not greater than 100. Default value is 50 percentage.

50

Integer

camel.faulttolerance.request​VolumeThreshold

Controls the size of the rolling window used when the circuit breaker is closed Default value is 20.

20

Integer

camel.faulttolerance.success​Threshold

Controls the number of trial calls which are allowed when the circuit breaker is half-open Default value is 1.

1

Integer

camel.faulttolerance.timeout​Duration

Configures the thread execution timeout. Default value is 1000 milliseconds.

1000

Long

camel.faulttolerance.timeout​Enabled

Whether timeout is enabled or not on the circuit breaker. Default is false.

false

Boolean

camel.faulttolerance.timeout​PoolSize

Configures the pool size of the thread pool when timeout is enabled. Default value is 10.

10

Integer

camel.faulttolerance.timeout​ScheduledExecutorServiceRef

References to a custom thread pool to use when timeout is enabled

String

Resilience4j EIP Circuit Breaker configurations

The camel.resilience4j supports 19 options, which are listed below.

Name Description Default Type

camel.resilience4j.automatic​TransitionFromOpenToHalfOpen​Enabled

Enables automatic transition from OPEN to HALF_OPEN state once the waitDurationInOpenState has passed.

false

Boolean

camel.resilience4j.bulkhead​Enabled

Whether bulkhead is enabled or not on the circuit breaker.

false

Boolean

camel.resilience4j.bulkheadMax​ConcurrentCalls

Configures the max amount of concurrent calls the bulkhead will support.

Integer

camel.resilience4j.bulkheadMax​WaitDuration

Configures a maximum amount of time which the calling thread will wait to enter the bulkhead. If bulkhead has space available, entry is guaranteed and immediate. If bulkhead is full, calling threads will contest for space, if it becomes available. maxWaitDuration can be set to 0. Note: for threads running on an event-loop or equivalent (rx computation pool, etc), setting maxWaitDuration to 0 is highly recommended. Blocking an event-loop thread will most likely have a negative effect on application throughput.

Integer

camel.resilience4j.circuit​BreakerRef

Refers to an existing io.github.resilience4j.circuitbreaker.CircuitBreaker instance to lookup and use from the registry. When using this, then any other circuit breaker options are not in use.

String

camel.resilience4j.configRef

Refers to an existing io.github.resilience4j.circuitbreaker.CircuitBreakerConfig instance to lookup and use from the registry.

String

camel.resilience4j.failureRate​Threshold

Configures the failure rate threshold in percentage. If the failure rate is equal or greater than the threshold the CircuitBreaker transitions to open and starts short-circuiting calls. The threshold must be greater than 0 and not greater than 100. Default value is 50 percentage.

50

Float

camel.resilience4j.minimum​NumberOfCalls

Configures configures the minimum number of calls which are required (per sliding window period) before the CircuitBreaker can calculate the error rate. For example, if minimumNumberOfCalls is 10, then at least 10 calls must be recorded, before the failure rate can be calculated. If only 9 calls have been recorded the CircuitBreaker will not transition to open even if all 9 calls have failed. Default minimumNumberOfCalls is 100

100

Integer

camel.resilience4j.permitted​NumberOfCallsInHalfOpenState

Configures the number of permitted calls when the CircuitBreaker is half open. The size must be greater than 0. Default size is 10.

10

Integer

camel.resilience4j.sliding​WindowSize

Configures the size of the sliding window which is used to record the outcome of calls when the CircuitBreaker is closed. slidingWindowSize configures the size of the sliding window. Sliding window can either be count-based or time-based. If slidingWindowType is COUNT_BASED, the last slidingWindowSize calls are recorded and aggregated. If slidingWindowType is TIME_BASED, the calls of the last slidingWindowSize seconds are recorded and aggregated. The slidingWindowSize must be greater than 0. The minimumNumberOfCalls must be greater than 0. If the slidingWindowType is COUNT_BASED, the minimumNumberOfCalls cannot be greater than slidingWindowSize . If the slidingWindowType is TIME_BASED, you can pick whatever you want. Default slidingWindowSize is 100.

100

Integer

camel.resilience4j.sliding​WindowType

Configures the type of the sliding window which is used to record the outcome of calls when the CircuitBreaker is closed. Sliding window can either be count-based or time-based. If slidingWindowType is COUNT_BASED, the last slidingWindowSize calls are recorded and aggregated. If slidingWindowType is TIME_BASED, the calls of the last slidingWindowSize seconds are recorded and aggregated. Default slidingWindowType is COUNT_BASED.

COUNT_BASED

String

camel.resilience4j.slowCall​DurationThreshold

Configures the duration threshold (seconds) above which calls are considered as slow and increase the slow calls percentage. Default value is 60 seconds.

60

Integer

camel.resilience4j.slowCall​RateThreshold

Configures a threshold in percentage. The CircuitBreaker considers a call as slow when the call duration is greater than slowCallDurationThreshold(Duration. When the percentage of slow calls is equal or greater the threshold, the CircuitBreaker transitions to open and starts short-circuiting calls. The threshold must be greater than 0 and not greater than 100. Default value is 100 percentage which means that all recorded calls must be slower than slowCallDurationThreshold.

100

Float

camel.resilience4j.timeout​CancelRunningFuture

Configures whether cancel is called on the running future. Defaults to true.

true

Boolean

camel.resilience4j.timeout​Duration

Configures the thread execution timeout (millis). Default value is 1000 millis (1 second).

1000

Integer

camel.resilience4j.timeout​Enabled

Whether timeout is enabled or not on the circuit breaker. Default is false.

false

Boolean

camel.resilience4j.timeout​ExecutorServiceRef

References to a custom thread pool to use when timeout is enabled (uses ForkJoinPool#commonPool() by default)

String

camel.resilience4j.wait​DurationInOpenState

Configures the wait duration (in seconds) which specifies how long the CircuitBreaker should stay open, before it switches to half open. Default value is 60 seconds.

60

Integer

camel.resilience4j.writable​StackTraceEnabled

Enables writable stack traces. When set to false, Exception.getStackTrace returns a zero length array. This may be used to reduce log spam when the circuit breaker is open as the cause of the exceptions is already known (the circuit breaker is short-circuiting calls).

false

Boolean

Hystrix (deprecated) EIP Circuit Breaker configurations

The camel.hystrix supports 31 options, which are listed below.

Name Description Default Type

camel.hystrix.allowMaximumSize​ToDivergeFromCoreSize

Allows the configuration for maximumSize to take effect. That value can then be equal to, or higher, than coreSize

false

Boolean

camel.hystrix.circuitBreaker​Enabled

Whether to use a HystrixCircuitBreaker or not. If false no circuit-breaker logic will be used and all requests permitted. This is similar in effect to circuitBreakerForceClosed() except that continues tracking metrics and knowing whether it should be open/closed, this property results in not even instantiating a circuit-breaker.

false

Boolean

camel.hystrix.circuitBreaker​ErrorThresholdPercentage

Error percentage threshold (as whole number such as 50) at which point the circuit breaker will trip open and reject requests. It will stay tripped for the duration defined in circuitBreakerSleepWindowInMilliseconds; The error percentage this is compared against comes from HystrixCommandMetrics.getHealthCounts().

Integer

camel.hystrix.circuitBreaker​ForceClosed

If true the HystrixCircuitBreaker#allowRequest() will always return true to allow requests regardless of the error percentage from HystrixCommandMetrics.getHealthCounts(). The circuitBreakerForceOpen() property takes precedence so if it set to true this property does nothing.

false

Boolean

camel.hystrix.circuitBreaker​ForceOpen

If true the HystrixCircuitBreaker.allowRequest() will always return false, causing the circuit to be open (tripped) and reject all requests. This property takes precedence over circuitBreakerForceClosed();

false

Boolean

camel.hystrix.circuitBreaker​RequestVolumeThreshold

Minimum number of requests in the metricsRollingStatisticalWindowInMilliseconds() that must exist before the HystrixCircuitBreaker will trip. If below this number the circuit will not trip regardless of error percentage.

Integer

camel.hystrix.circuitBreaker​SleepWindowInMilliseconds

The time in milliseconds after a HystrixCircuitBreaker trips open that it should wait before trying requests again.

Integer

camel.hystrix.corePoolSize

Core thread-pool size that gets passed to java.util.concurrent.ThreadPoolExecutor#setCorePoolSize(int)

Integer

camel.hystrix.execution​IsolationSemaphoreMax​ConcurrentRequests

Number of concurrent requests permitted to HystrixCommand.run(). Requests beyond the concurrent limit will be rejected. Applicable only when executionIsolationStrategy == SEMAPHORE.

Integer

camel.hystrix.execution​IsolationStrategy

What isolation strategy HystrixCommand.run() will be executed with. If THREAD then it will be executed on a separate thread and concurrent requests limited by the number of threads in the thread-pool. If SEMAPHORE then it will be executed on the calling thread and concurrent requests limited by the semaphore count.

String

camel.hystrix.execution​IsolationThreadInterruptOn​Timeout

Whether the execution thread should attempt an interrupt (using Future#cancel ) when a thread times out. Applicable only when executionIsolationStrategy() == THREAD.

false

Boolean

camel.hystrix.executionTimeout​Enabled

Whether the timeout mechanism is enabled for this command

false

Boolean

camel.hystrix.executionTimeout​InMilliseconds

Time in milliseconds at which point the command will timeout and halt execution. If executionIsolationThreadInterruptOnTimeout == true and the command is thread-isolated, the executing thread will be interrupted. If the command is semaphore-isolated and a HystrixObservableCommand, that command will get unsubscribed.

Integer

camel.hystrix.fallbackEnabled

Whether HystrixCommand.getFallback() should be attempted when failure occurs.

false

Boolean

camel.hystrix.fallback​IsolationSemaphoreMax​ConcurrentRequests

Number of concurrent requests permitted to HystrixCommand.getFallback(). Requests beyond the concurrent limit will fail-fast and not attempt retrieving a fallback.

Integer

camel.hystrix.groupKey

Sets the group key to use. The default value is CamelHystrix.

String

camel.hystrix.keepAliveTime

Keep-alive time in minutes that gets passed to ThreadPoolExecutor#setKeepAliveTime(long,TimeUnit)

Integer

camel.hystrix.maximumSize

Maximum thread-pool size that gets passed to ThreadPoolExecutor#setMaximumPoolSize(int) . This is the maximum amount of concurrency that can be supported without starting to reject HystrixCommands. Please note that this setting only takes effect if you also set allowMaximumSizeToDivergeFromCoreSize

Integer

camel.hystrix.maxQueueSize

Max queue size that gets passed to BlockingQueue in HystrixConcurrencyStrategy.getBlockingQueue(int) This should only affect the instantiation of a threadpool - it is not eliglible to change a queue size on the fly. For that, use queueSizeRejectionThreshold().

Integer

camel.hystrix.metricsHealth​SnapshotIntervalInMilliseconds

Time in milliseconds to wait between allowing health snapshots to be taken that calculate success and error percentages and affect HystrixCircuitBreaker.isOpen() status. On high-volume circuits the continual calculation of error percentage can become CPU intensive thus this controls how often it is calculated.

Integer

camel.hystrix.metricsRolling​PercentileBucketSize

Maximum number of values stored in each bucket of the rolling percentile. This is passed into HystrixRollingPercentile inside HystrixCommandMetrics.

Integer

camel.hystrix.metricsRolling​PercentileEnabled

Whether percentile metrics should be captured using HystrixRollingPercentile inside HystrixCommandMetrics.

false

Boolean

camel.hystrix.metricsRolling​PercentileWindowBuckets

Number of buckets the rolling percentile window is broken into. This is passed into HystrixRollingPercentile inside HystrixCommandMetrics.

Integer

camel.hystrix.metricsRolling​PercentileWindowInMilliseconds

Duration of percentile rolling window in milliseconds. This is passed into HystrixRollingPercentile inside HystrixCommandMetrics.

Integer

camel.hystrix.metricsRolling​StatisticalWindowBuckets

Number of buckets the rolling statistical window is broken into. This is passed into HystrixRollingNumber inside HystrixCommandMetrics.

Integer

camel.hystrix.metricsRolling​StatisticalWindowIn​Milliseconds

This property sets the duration of the statistical rolling window, in milliseconds. This is how long metrics are kept for the thread pool. The window is divided into buckets and rolls by those increments.

Integer

camel.hystrix.queueSize​RejectionThreshold

Queue size rejection threshold is an artificial max size at which rejections will occur even if maxQueueSize has not been reached. This is done because the maxQueueSize of a BlockingQueue can not be dynamically changed and we want to support dynamically changing the queue size that affects rejections. This is used by HystrixCommand when queuing a thread for execution.

Integer

camel.hystrix.requestLog​Enabled

Whether HystrixCommand execution and events should be logged to HystrixRequestLog.

false

Boolean

camel.hystrix.threadPoolKey

Sets the thread pool key to use. Will by default use the same value as groupKey has been configured to use.

String

camel.hystrix.threadPool​RollingNumberStatisticalWindow​Buckets

Number of buckets the rolling statistical window is broken into. This is passed into HystrixRollingNumber inside each HystrixThreadPoolMetrics instance.

Integer

camel.hystrix.threadPool​RollingNumberStatisticalWindow​InMilliseconds

Duration of statistical rolling window in milliseconds. This is passed into HystrixRollingNumber inside each HystrixThreadPoolMetrics instance.

Integer

Camel Saga EIP (Long Running Actions) configurations

The camel.lra supports 4 options, which are listed below.

Name Description Default Type

camel.lra.coordinatorContext​Path

The context-path for the LRA coordinator. Is default /lra-coordinator

/lra-coordinator

String

camel.lra.coordinatorUrl

The URL for the LRA coordinator service that orchestrates the transactions

String

camel.lra.localParticipant​ContextPath

The context-path for the local participant. Is default /lra-participant

/lra-participant

String

camel.lra.localParticipantUrl

The URL for the local participant

String

Specifying custom beans

Custom beans can be configured in camel-main via properties (such as in the application.properties file).

For example to create a DataSource for a Postgress database, you can create a new bean instance via #class: with the class name (fully qualified). Properties on the data source can then additional configured such as the server and database name, etc.

camel.beans.myDS = #class:org.postgresql.jdbc3.Jdbc3PoolingDataSource
camel.beans.myDS.dataSourceName = myDS
camel.beans.myDS.serverName = mypostrgress
camel.beans.myDS.databaseName = test
camel.beans.myDS.user = testuser
camel.beans.myDS.password = testpassword
camel.beans.myDS.maxConnections = 10

The bean is registered in the Camel Registry with the name myDS.

If you use the SQL component then the datasource can be configured on the SQL component:

camel.component.sql.dataSource = #myDS

To refer to a custom bean you may want to favour using #bean: style, as this states the intention more clearly that its referring to a bean, and not just a text value that happens to start with a # sign:

camel.component.sql.dataSource = #bean:myDS

Creating a custom bean with constructor parameters

When creating a bean then parameters to the constructor can be provided. Suppose we have a class MyFoo with a constructor:

public class MyFoo {
    private String name;
    private boolean important;
    private int id;

    public MyFoo(String name, boolean important, int id) {
        this.name = name;
        this.important = important;
        this.id = id;
    }
}

Then we can create a bean instance with name foo and provide parameters to the constructor as shown:

camel.beans.foo = #class:com.foo.MyBean("Hello World", true, 123)

Creating custom beans with factory method

When creating a bean then parameters to a factorty method can be provided. Suppose we have a class MyFoo with a static factory method:

public class MyFoo {
    private String name;
    private boolean important;
    private int id;

    private MyFoo() {
        // use factory method
    }

    public static MyFoo buildFoo(String name, boolean important, int id) {
        MyFoo foo = new MyFoo();
        foo.name = name;
        foo.important = important;
        foo.id = id;
        return foo;
    }
}

Then we can create a bean instance with name foo and provide parameters to the static factory method as shown:

camel.beans.foo = #class:com.foo.MyBean#buildFoo("Hello World", true, 123)
The syntax must use #factoryMethodName to tell Camel that the bean should be created from a factory method.

Optional parameters on beans

If a parameter on a bean is not mandatory then the parameter can be marked as optional using ? syntax, as shown:

camel.beans.foo = #class:com.foo.MyBean("Hello World", true, 123)
camel.beans.foo.?company = Acme

Then the company parameter is only set if MyBean has this option (silent ignore if no option present). Otherwise, if a parameter is set, and the bean does not have such a parameter, then an exception is thrown by Camel.

Nested parameters on beans

You can configure nested parameters separating them via . (dot).

For example given this Country class:

public class Country {
    private String iso;
    private String name;

    public void setIso(String iso) {
        this.iso = iso;
    }

    public void setName(String name) {
        this.name = name;
    }
}

Which is an option on the MyBean class. Then we can then configure its iso and name parameter as shown below:

camel.beans.foo = #class:com.foo.MyBean("Hello World", true, 123)
camel.beans.foo.country.iso = USA
camel.beans.foo.country.name = United States of America

Camel will automatically create an instance of Country if MyBean has a getter/setter for this option, and that the Country bean has a default no-arg constructor.

Configuring singleton beans by their type

In the example above the SQL component was configured with the name of the DataSource. There can be situations where you know there is only a single instance of a data source in the Camel registry. In such a situation you can instead refer to the class or interface type via the #type: prefix as shown below:

camel.component.sql.dataSource = #type:javax.sql.DataSource

If there is no bean in the registry with the type javax.sql.DataSource then the option isn’t configured.

Autowiring beans

The example above can be taken one step further by letting camel-main try to autowire the beans.

camel.component.sql.dataSource = #autowired

In this situation then #autowrired will make Camel detect the type of the dataSource option on the SQL component. Because type is a javax.sql.DataSource instance, then Camel will lookup in the registry if there is a single instance of the same type. If there is no such bean then the option isn’t configured.

Defining a Map bean

You can specify java.util.Map beans in camel-main via properties (such as in the application.properties file).

Maps have a special syntax with brackets as shown below:

camel.beans.mymap[table] = 12
camel.beans.mymap[food] = Big Burger
camel.beans.mymap[cheese] = yes
camel.beans.mymap[quantity] = 1

The Map is registered in the Camel Registry with the name mymap.

Defining a List bean

This is similar to Map bean where the key is the index, eg 0, 1, 2, etc:

camel.beans.myprojects[0] = Camel
camel.beans.myprojects[1] = Kafka
camel.beans.myprojects[2] = Quarkus

The List is registered in the Camel Registry with the name myprojects.

Examples

You can find a set of examples using camel-main in Camel Examples which demonstrate running Camel in standalone with camel-main.