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 table lists all the options:
Name | Description | Default | Type |
---|---|---|---|
camel.main.allowUseOriginalMessage |
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. |
boolean |
|
camel.main.autoConfigurationEnabled |
Whether auto configuration of components, dataformats, languages is enabled or not. When enabled the configuration parameters are loaded from the properties component and optionally from the classpath file META-INF/services/org/apache/camel/autowire.properties. 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.autoConfigurationEnvironmentVariablesEnabled |
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.autoConfigurationFailFast |
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.autoConfigurationLogSummary |
Whether auto configuration should log a summary with the configured properties. 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.autowireComponentProperties |
Whether autowiring components with properties that are of same type, which has been added to the Camel registry, as a singleton instance. This is used for convention over configuration to inject DataSource, AmazonLogin instances to the components. This option is default enabled. |
true |
boolean |
camel.main.autowireComponentPropertiesAllowPrivateSetter |
Whether autowiring components allows to use private setter method when setting the value. This may be needed in some rare situations when some configuration classes may configure via constructors over setters. But constructor configuration is more cumbersome to use via .properties files etc. |
true |
boolean |
camel.main.autowireComponentPropertiesDeep |
Whether autowiring components (with deep nesting by attempting to walk as deep down the object graph by creating new empty objects on the way if needed) with properties that are of same type, which has been added to the Camel registry, as a singleton instance. This is used for convention over configuration to inject DataSource, AmazonLogin instances to the components. This option is default disabled. |
boolean |
|
camel.main.autowireComponentPropertiesNonNullOnly |
Whether to only autowire if the property has no default value or has not been configured explicit. This option is default disabled. |
boolean |
|
camel.main.backlogTracing |
Sets whether backlog tracing is enabled or not. Default is false. |
boolean |
|
camel.main.beanIntrospectionExtendedStatistics |
Sets whether bean introspection uses extended statistics. The default is false. |
boolean |
|
camel.main.beanIntrospectionLoggingLevel |
Sets the logging level used by bean introspection, logging activity of its usage. The default is TRACE. |
LoggingLevel |
|
camel.main.beanPostProcessorEnabled |
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.caseInsensitiveHeaders |
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.configurationClasses |
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.consumerTemplateCacheSize |
Consumer template endpoints cache size. |
1000 |
int |
camel.main.durationHitExitCode |
Sets the exit code for the application if duration was hit |
int |
|
camel.main.durationMaxIdleSeconds |
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.endpointBasicPropertyBinding |
Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities. The default value is false. |
boolean |
|
camel.main.endpointBridgeErrorHandler |
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. |
boolean |
|
camel.main.endpointLazyStartProducer |
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. |
boolean |
|
camel.main.endpointRuntimeStatisticsEnabled |
Sets whether endpoint runtime statistics is enabled (gathers runtime usage of each incoming and outgoing endpoints). The default value is 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.inflightRepositoryBrowseEnabled |
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. |
boolean |
|
camel.main.javaRoutesExcludePattern |
Used for exclusive filtering component scanning of RouteBuilder classes with Component annotation. 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.javaRoutesIncludePattern |
Used for inclusive filtering component scanning of RouteBuilder classes with Component annotation. 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 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.jmxManagementNamePattern |
The naming pattern for creating the CamelContext JMX management name. The default pattern is name |
name |
String |
camel.main.jmxManagementStatisticsLevel |
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 |
Experimental: 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. |
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. |
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.logExhaustedMessageBody |
Sets whether to log exhausted message body with message history. Default is false. |
boolean |
|
camel.main.logMask |
Sets whether log mask is enabled or not. Default is false. |
boolean |
|
camel.main.mdcLoggingKeysPattern |
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. |
boolean |
|
camel.main.name |
Sets the name of the CamelContext. |
String |
|
camel.main.packageScanRouteBuilders |
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.producerTemplateCacheSize |
Producer template endpoints cache size. |
1000 |
int |
camel.main.routeControllerBackOffDelay |
Backoff delay in millis when restarting a route that failed to startup. |
long |
|
camel.main.routeControllerBackOffMaxAttempts |
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.routeControllerBackOffMaxDelay |
Backoff maximum delay in millis when restarting a route that failed to startup. |
long |
|
camel.main.routeControllerBackOffMaxElapsedTime |
Backoff maximum elapsed time in millis, after which the backoff should be considered exhausted and no more attempts should be made. |
long |
|
camel.main.routeControllerBackOffMultiplier |
Backoff multiplier to use for exponential backoff. This is used to extend the delay between restart attempts. |
double |
|
camel.main.routeControllerExcludeRoutes |
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.routeControllerIncludeRoutes |
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.routeControllerInitialDelay |
Initial delay in milli seconds before the route controller starts, after CamelContext has been started. |
long |
|
camel.main.routeControllerRouteStartupLoggingLevel |
Sets the logging level used for logging route startup activity. By default INFO level is used. You can use this to change the level for example to OFF if this kind of logging is not wanted. |
INFO |
LoggingLevel |
camel.main.routeControllerSuperviseEnabled |
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. |
boolean |
|
camel.main.routeControllerThreadPoolSize |
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.routeControllerUnhealthyOnExhausted |
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. |
boolean |
|
camel.main.routeFilterExcludePattern |
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.routeFilterIncludePattern |
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.routesBuilderClasses |
Sets classes names that implement RoutesBuilder . |
String |
|
camel.main.routesBuilders |
Sets the RoutesBuilder instances. |
List |
|
camel.main.routesCollectorEnabled |
Whether the routes collector is enabled or not. When enabled Camel will auto-discover routes (RouteBuilder instances from the registry and also load additional XML routes from the file system. The routes collector is default enabled. |
true |
boolean |
camel.main.shutdownLogInflightExchangesOnTimeout |
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.shutdownNowOnTimeout |
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.shutdownRoutesInReverseOrder |
Sets whether routes should be shutdown in reverse or the same order as they were started. |
true |
boolean |
camel.main.shutdownSuppressLoggingOnTimeout |
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. |
boolean |
|
camel.main.shutdownTimeout |
Timeout in seconds to graceful shutdown Camel. |
45 |
int |
camel.main.streamCachingAnySpoolRules |
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. |
boolean |
|
camel.main.streamCachingBufferSize |
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.streamCachingEnabled |
Sets whether stream caching is enabled or not. Default is false. |
boolean |
|
camel.main.streamCachingRemoveSpoolDirectoryWhenStopping |
Whether to remove stream caching temporary directory when stopping. This option is default true. |
true |
boolean |
camel.main.streamCachingSpoolCipher |
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.streamCachingSpoolDirectory |
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.streamCachingSpoolThreshold |
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.streamCachingSpoolUsedHeapMemoryLimit |
Sets what the upper bounds should be when streamCachingSpoolUsedHeapMemoryThreshold is in use. |
String |
|
camel.main.streamCachingSpoolUsedHeapMemoryThreshold |
Sets a percentage (1-99) of used heap memory threshold to activate stream caching spooling to disk. |
int |
|
camel.main.streamCachingStatisticsEnabled |
Sets whether stream caching statistics is enabled. |
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. |
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.useBreadcrumb |
Set whether breadcrumb is enabled. The default value is 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. |
boolean |
|
camel.main.useMdcLogging |
To turn on MDC logging |
boolean |
|
camel.main.xmlRests |
Directory to scan for adding additional XML rests. You can turn this off by setting the value to false. Files can be loaded from either classpath or file by prefixing with classpath: or file: Wildcards is supported using a ANT pattern style paths, such as classpath:**/*camel*.xml Notice when using wildcards, then there is additional overhead as the classpath is scanned, where as if you specific the exact name for each XML file is faster as no classpath scanning is needed. Multiple directories can be specified and separated by comma, such as: file:/myapp/mycamel/*.xml,file:/myapp/myothercamel/*.xml |
classpath:camel-rest/*.xml |
String |
camel.main.xmlRoutes |
Directory to scan for adding additional XML routes. You can turn this off by setting the value to false. Files can be loaded from either classpath or file by prefixing with classpath: or file: Wildcards is supported using a ANT pattern style paths, such as classpath:**/*camel*.xml Notice when using wildcards, then there is additional overhead as the classpath is scanned, where as if you specific the exact name for each XML file is faster as no classpath scanning is needed. Multiple directories can be specified and separated by comma, such as: file:/myapp/mycamel/*.xml,file:/myapp/myothercamel/*.xml |
classpath:camel/*.xml |
String |
camel.main.xmlRouteTemplates |
Directory to scan for adding additional XML route templates. You can turn this off by setting the value to false. Files can be loaded from either classpath or file by prefixing with classpath: or file: Wildcards is supported using a ANT pattern style paths, such as classpath:**/*template-*.xml Notice when using wildcards, then there is additional overhead as the classpath is scanned, where as if you specific the exact name for each XML file is faster as no classpath scanning is needed. Multiple directories can be specified and separated by comma, such as: file:/myapp/mycamel/*.xml,file:/myapp/myothercamel/*.xml |
classpath:camel-template/*.xml |
String |
camel.faulttolerance.bulkheadEnabled |
Whether bulkhead is enabled or not on the circuit breaker. Default is false. |
false |
Boolean |
camel.faulttolerance.bulkheadExecutorServiceRef |
References to a custom thread pool to use when bulkhead is enabled. |
String |
|
camel.faulttolerance.bulkheadMaxConcurrentCalls |
Configures the max amount of concurrent calls the bulkhead will support. Default value is 10. |
10 |
Integer |
camel.faulttolerance.bulkheadWaitingTaskQueue |
Configures the task queue size for holding waiting tasks to be processed by the bulkhead. Default value is 10. |
10 |
Integer |
camel.faulttolerance.circuitBreakerRef |
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.failureRatio |
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.requestVolumeThreshold |
Controls the size of the rolling window used when the circuit breaker is closed Default value is 20. |
20 |
Integer |
camel.faulttolerance.successThreshold |
Controls the number of trial calls which are allowed when the circuit breaker is half-open Default value is 1. |
1 |
Integer |
camel.faulttolerance.timeoutDuration |
Configures the thread execution timeout. Default value is 1000 milliseconds. |
1000 |
Long |
camel.faulttolerance.timeoutEnabled |
Whether timeout is enabled or not on the circuit breaker. Default is false. |
false |
Boolean |
camel.faulttolerance.timeoutPoolSize |
Configures the pool size of the thread pool when timeout is enabled. Default value is 10. |
10 |
Integer |
camel.faulttolerance.timeoutScheduledExecutorServiceRef |
References to a custom thread pool to use when timeout is enabled |
String |
|
camel.health.config |
Set additional HealthConfigurationProperties for fine grained configuration of health checks. |
Map |
|
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.hystrix.allowMaximumSizeToDivergeFromCoreSize |
Allows the configuration for maximumSize to take effect. That value can then be equal to, or higher, than coreSize |
Boolean |
|
camel.hystrix.circuitBreakerEnabled |
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. |
Boolean |
|
camel.hystrix.circuitBreakerErrorThresholdPercentage |
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.circuitBreakerForceClosed |
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. |
Boolean |
|
camel.hystrix.circuitBreakerForceOpen |
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(); |
Boolean |
|
camel.hystrix.circuitBreakerRequestVolumeThreshold |
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.circuitBreakerSleepWindowInMilliseconds |
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.executionIsolationSemaphoreMaxConcurrentRequests |
Number of concurrent requests permitted to HystrixCommand.run(). Requests beyond the concurrent limit will be rejected. Applicable only when executionIsolationStrategy == SEMAPHORE. |
Integer |
|
camel.hystrix.executionIsolationStrategy |
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.executionIsolationThreadInterruptOnTimeout |
Whether the execution thread should attempt an interrupt (using Future#cancel ) when a thread times out. Applicable only when executionIsolationStrategy() == THREAD. |
Boolean |
|
camel.hystrix.executionTimeoutEnabled |
Whether the timeout mechanism is enabled for this command |
Boolean |
|
camel.hystrix.executionTimeoutInMilliseconds |
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. |
Boolean |
|
camel.hystrix.fallbackIsolationSemaphoreMaxConcurrentRequests |
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.metricsHealthSnapshotIntervalInMilliseconds |
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.metricsRollingPercentileBucketSize |
Maximum number of values stored in each bucket of the rolling percentile. This is passed into HystrixRollingPercentile inside HystrixCommandMetrics. |
Integer |
|
camel.hystrix.metricsRollingPercentileEnabled |
Whether percentile metrics should be captured using HystrixRollingPercentile inside HystrixCommandMetrics. |
Boolean |
|
camel.hystrix.metricsRollingPercentileWindowBuckets |
Number of buckets the rolling percentile window is broken into. This is passed into HystrixRollingPercentile inside HystrixCommandMetrics. |
Integer |
|
camel.hystrix.metricsRollingPercentileWindowInMilliseconds |
Duration of percentile rolling window in milliseconds. This is passed into HystrixRollingPercentile inside HystrixCommandMetrics. |
Integer |
|
camel.hystrix.metricsRollingStatisticalWindowBuckets |
Number of buckets the rolling statistical window is broken into. This is passed into HystrixRollingNumber inside HystrixCommandMetrics. |
Integer |
|
camel.hystrix.metricsRollingStatisticalWindowInMilliseconds |
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.queueSizeRejectionThreshold |
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.requestLogEnabled |
Whether HystrixCommand execution and events should be logged to HystrixRequestLog. |
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.threadPoolRollingNumberStatisticalWindowBuckets |
Number of buckets the rolling statistical window is broken into. This is passed into HystrixRollingNumber inside each HystrixThreadPoolMetrics instance. |
Integer |
|
camel.hystrix.threadPoolRollingNumberStatisticalWindowInMilliseconds |
Duration of statistical rolling window in milliseconds. This is passed into HystrixRollingNumber inside each HystrixThreadPoolMetrics instance. |
Integer |
|
camel.lra.coordinatorContextPath |
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.localParticipantContextPath |
The context-path for the local participant. Is default /lra-participant |
/lra-participant |
String |
camel.lra.localParticipantUrl |
The URL for the local participant |
String |
|
camel.resilience4j.automaticTransitionFromOpenToHalfOpenEnabled |
Enables automatic transition from OPEN to HALF_OPEN state once the waitDurationInOpenState has passed. |
Boolean |
|
camel.resilience4j.bulkheadEnabled |
Whether bulkhead is enabled or not on the circuit breaker. |
false |
Boolean |
camel.resilience4j.bulkheadMaxConcurrentCalls |
Configures the max amount of concurrent calls the bulkhead will support. |
Integer |
|
camel.resilience4j.bulkheadMaxWaitDuration |
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.circuitBreakerRef |
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.failureRateThreshold |
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.minimumNumberOfCalls |
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.permittedNumberOfCallsInHalfOpenState |
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.slidingWindowSize |
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.slidingWindowType |
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.slowCallDurationThreshold |
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.slowCallRateThreshold |
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.timeoutCancelRunningFuture |
Configures whether cancel is called on the running future. Defaults to true. |
true |
Boolean |
camel.resilience4j.timeoutDuration |
Configures the thread execution timeout (millis). Default value is 1000 millis (1 second). |
1000 |
Integer |
camel.resilience4j.timeoutEnabled |
Whether timeout is enabled or not on the circuit breaker. Default is false. |
false |
Boolean |
camel.resilience4j.timeoutExecutorServiceRef |
References to a custom thread pool to use when timeout is enabled (uses ForkJoinPool#commonPool() by default) |
String |
|
camel.resilience4j.waitDurationInOpenState |
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.writableStackTraceEnabled |
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). |
Boolean |
|
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. |
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 an specific hostname for the API documentation (eg swagger) 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. |
boolean |
|
camel.rest.bindingMode |
Sets the binding mode to be used by the REST consumer |
RestBindingMode.off |
RestBindingMode |
camel.rest.clientRequestValidation |
Whether to enable validation of the client request to check whether the Content-Type and Accept headers from the client is supported by the Rest-DSL configuration of its consumes/produces settings. This can be turned on, to enable this check. In case of validation error, then HTTP Status codes 415 or 406 is returned. The default value is 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.dataFormatProperties |
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 |
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.skipBindingOnErrorCode |
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 |
WWhether 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 |
|
camel.threadpool.allowCoreThreadTimeOut |
Sets default whether to allow core threads to timeout |
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.rejectedPolicy |
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 |
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)
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 automatic 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.
As the 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
.