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 119 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.backlogTracing​Standby

Whether to set backlog tracing on standby. If on standby then the backlog tracer is installed and made available. Then the backlog tracer can be enabled later at runtime via JMX or via Java API. Default is false.

false

boolean

camel.main.backlogTracing​Templates

Whether backlog tracing should trace inner details from route templates (or kamelets). Turning this on increases the verbosity of tracing by including events from internal routes in the templates or kamelets. Default is false.

false

boolean

camel.main.basePackageScan

Package name to use as base (offset) for classpath scanning of RouteBuilder , and org.apache.camel.TypeConverter classes. If you are using Spring Boot then it is 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.basePackageScan​Enabled

Whether base package scan is enabled.

true

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.camelEvents​TimestampEnabled

Whether to include timestamps for all emitted Camel Events. Enabling this allows to know fine-grained at what time each event was emitted, which can be used for reporting to report exactly the time of the events. This is by default false to avoid the overhead of including this information.

false

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.contextReload​Enabled

Used for enabling context reloading. If enabled then Camel allow external systems such as security vaults (AWS secrets manager, etc.) to trigger refreshing Camel by updating property placeholders and reload all existing routes to take changes into effect.

false

boolean

camel.main.debugging

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

false

boolean

camel.main.description

Sets the description (intended for humans) of the Camel application.

String

camel.main.devConsoleEnabled

Whether to enable developer console (requires camel-console on classpath). The developer console is only for assisting during development. This is NOT for production usage.

false

boolean

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 being 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.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.extraShutdown​Timeout

Extra timeout in seconds to graceful shutdown Camel. When Camel is shutting down then Camel first shutdown all the routes (shutdownTimeout). Then additional services is shutdown (extraShutdownTimeout).

15

int

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.jmxManagementMBeans​Level

Sets the mbeans registration level. The default value is Default.

Default

ManagementMBeansLevel

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.loadStatistics​Enabled

Sets whether context load statistics is enabled (something like the unix load average). The statistics requires to have camel-management on the classpath as JMX is required. The default value is false.

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.modeline

Whether camel-k style modeline is also enabled when not using camel-k. Enabling this allows to use a camel-k like experience by being able to configure various settings using modeline directly in your route source code.

false

boolean

camel.main.name

Sets the name of the CamelContext.

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.

false

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 all the Camel routes.

45

int

camel.main.sourceLocation​Enabled

Whether to capture precise source location:line-number for all EIPs in Camel routes. Enabling this will impact parsing Java based routes (also Groovy, Kotlin, etc.) on startup as this uses JDK StackTraceElement to calculate the location from the Camel route, which comes with a performance cost. This only impact startup, not the performance of the routes at runtime.

false

boolean

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. While stream types (like StreamSource, InputStream and Reader) are commonly used in messaging for performance reasons, they also have an important drawback: they can only be read once. In order to be able to work with message content multiple times, the stream needs to be cached. Streams are cached in memory only (by default). If streamCachingSpoolEnabled=true, then, for large stream messages (over 128 KB by default) will be cached in a temporary file instead, and Camel will handle deleting the temporary file once the cached stream is no longer necessary. Default is true.

true

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​Enabled

To enable stream caching spooling to disk. This means, for large stream messages (over 128 KB by default) will be cached in a temporary file instead, and Camel will handle deleting the temporary file once the cached stream is no longer necessary. Default is false.

false

boolean

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.tracingLogging​Format

To use a custom tracing logging format. The default format (arrow, routeId, label) is: %-4.4s %-12.12s %-33.33s

%-4.4s [%-12.12s] [%-33.33s]

String

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.tracingTemplates

Whether tracing should trace inner details from route templates (or kamelets). Turning this on increases the verbosity of tracing by including events from internal routes in the templates or kamelets. Default is false.

false

boolean

camel.main.typeConverter​StatisticsEnabled

Sets whether type converter statistics is enabled. By default the type converter utilization statistics is disabled. Notice: If enabled then there is a slight performance impact under very heavy load.

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 8 options, which are listed below.

Name Description Default Type

camel.health.componentsEnabled

Whether components health check is enabled

true

Boolean

camel.health.consumersEnabled

Whether consumers health check is enabled

true

Boolean

camel.health.enabled

Whether health check is enabled globally

true

Boolean

camel.health.excludePattern

Pattern to exclude health checks from being invoked by Camel when checking healths. Multiple patterns can be separated by comma.

String

camel.health.exposureLevel

Sets the level of details to exposure as result of invoking health checks. There are the following levels: full, default, oneline The full level will include all details and status from all the invoked health checks. The default level will report UP if everything is okay, and only include detailed information for health checks that was DOWN. The oneline level will only report either UP or DOWN.

default

String

camel.health.initialState

The initial state of health-checks (readiness). There are the following states: UP, DOWN, UNKNOWN. By default, the state is DOWN, is regarded as being pessimistic/careful. This means that the overall health checks may report as DOWN during startup and then only if everything is up and running flip to being UP. Setting the initial state to UP, is regarded as being optimistic. This means that the overall health checks may report as UP during startup and then if a consumer or other service is in fact un-healthy, then the health-checks can flip being DOWN. Setting the state to UNKNOWN means that some health-check would be reported in unknown state, especially during early bootstrap where a consumer may not be fully initialized or validated a connection to a remote system. This option allows to pre-configure the state for different modes.

down

String

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 27 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.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.inlineRoutes

Inline routes in rest-dsl which are linked using direct endpoints. By default, each service in Rest DSL is an individual route, meaning that you would have at least two routes per service (rest-dsl, and the route linked from rest-dsl). Enabling this allows Camel to optimize and inline this as a single route, however this requires to use direct endpoints, which must be unique per service. This option is default false.

false

boolean

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-openapi-java, or 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

Camel AWS Vault configurations

The camel.vault.aws supports 9 options, which are listed below.

Name Description Default Type

camel.vault.aws.accessKey

The AWS access key

String

camel.vault.aws.default​CredentialsProvider

Define if we want to use the AWS Default Credentials Provider or not

false

boolean

camel.vault.aws.profile​CredentialsProvider

Define if we want to use the AWS Profile Credentials Provider or not

false

boolean

camel.vault.aws.profileName

Define the profile name to use if Profile Credentials Provider is selected

String

camel.vault.aws.refreshEnabled

Whether to automatically reload Camel upon secrets being updated in AWS.

false

boolean

camel.vault.aws.refreshPeriod

The period (millis) between checking AWS for updated secrets.

30000

long

camel.vault.aws.region

The AWS region

String

camel.vault.aws.secretKey

The AWS secret key

String

camel.vault.aws.secrets

Specify the secret names (or pattern) to check for updates. Multiple secrets can be separated by comma.

String

Camel GCP Vault configurations

The camel.vault.gcp supports 7 options, which are listed below.

Name Description Default Type

camel.vault.gcp.projectId

The GCP Project ID

String

camel.vault.gcp.refreshEnabled

Whether to automatically reload Camel upon secrets being updated in AWS.

false

boolean

camel.vault.gcp.refreshPeriod

The period (millis) between checking Google for updated secrets.

30000

long

camel.vault.gcp.secrets

Specify the secret names (or pattern) to check for updates. Multiple secrets can be separated by comma.

String

camel.vault.gcp.serviceAccount​Key

The Service Account Key location

String

camel.vault.gcp.subscription​Name

Define the Google Pubsub subscription Name to be used when checking for updates

String

camel.vault.gcp.useDefault​Instance

Define if we want to use the GCP Client Default Instance or not

false

boolean

Camel Azure Key Vault configurations

The camel.vault.azure supports 11 options, which are listed below.

Name Description Default Type

camel.vault.azure.blobAccess​Key

The Eventhubs Blob Access Key for CheckpointStore purpose

String

camel.vault.azure.blobAccount​Name

The Eventhubs Blob Account Name for CheckpointStore purpose

String

camel.vault.azure.blob​ContainerName

The Eventhubs Blob Container Name for CheckpointStore purpose

String

camel.vault.azure.clientId

The client Id for accessing Azure Key Vault

String

camel.vault.azure.clientSecret

The client Secret for accessing Azure Key Vault

String

camel.vault.azure.eventhub​ConnectionString

The Eventhubs connection String for Key Vault Secret events notifications

String

camel.vault.azure.refresh​Enabled

Whether to automatically reload Camel upon secrets being updated in Azure.

false

boolean

camel.vault.azure.refresh​Period

The period (millis) between checking Azure for updated secrets.

30000

long

camel.vault.azure.secrets

Specify the secret names (or pattern) to check for updates. Multiple secrets can be separated by comma.

String

camel.vault.azure.tenantId

The Tenant Id for accessing Azure Key Vault

String

camel.vault.azure.vaultName

The vault Name in Azure Key Vault

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​ExecutorService

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​Breaker

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​ScheduledExecutorService

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

String

Resilience4j EIP Circuit Breaker configurations

The camel.resilience4j supports 20 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​Breaker

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.config

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.throw​ExceptionWhenHalfOpenOrOpen​State

Whether to throw io.github.resilience4j.circuitbreaker.CallNotPermittedException when the call is rejected due circuit breaker is half open or open.

false

Boolean

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​ExecutorService

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

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

Package Scanning

Available since Camel 3.16

When running Camel standalone via camel-main JAR, then Camel will use package scanning to discover:

  • Camel routes by discovering RouteBuilder classes

  • Camel configuration classes by discovering CamelConfiguration classes or classes annotated with @Configuration.

  • Camel type converters by discovering classes annotated with @Converter

To use package scanning then Camel needs to know the base package to use as offset. This can be specified either with the camel.main.basePackage option or via Main class as shown below:

package com.foo.acme;

public class MyCoolApplication {

    public static void main(String[] args) {
        Main main = new Main(MyCoolApplication.class);
        main.run();
    }

}

In the example above, then we use com.foo.acme as the base package, which is done by passing in the class in the Main constructor. This is similar with how Spring Boot does this.

Camel will then scan from the base package and the sub packages.

Disabling Package Scanning

Package scanning can be turned off by setting camel.main.basePackageScanEnabled=false.

There is a little overhead when using package scanning as Camel performs this scan during startup.

Configuring Camel Main applications

You can use configuration classes to configure Camel Main applications from Java.

In Camel 3.16 onwards the configuration classes must either implement the interface org.apache.camel.CamelConfiguration, or be annotated with @Configuration (or both). In previous versions this was not required.

For example to configure a Camel application by creating custom beans you can do:

public class MyConfiguration implements CamelConfiguration {

    @BindToRegistry
    public MyBean myAwesomeBean() {
        MyBean bean = new MyBean();
        // do something on bean
        return bean;
    }

    public void configure(CamelContext camelContext) throws Exception {
        // this method is optional and can be omitted
        // do any kind of configuration here if needed
    }

}

In the configuration class you can also have custom methods that creates beans, such as the myAwesomeBean method that creates the MyBean and registers it with the name myAwesomeBean (defaults to method name).

This is similar to Spring Boot where you can also do this with the Spring Boot @Bean annotations, or in Quarkus/CDI with the @Produces annotation.

Using annotation based configuration classes

Instead of configuration classes that implements CamelConfiguration, you can annotate the class with org.apache.camel.@Configuration as shown:

@Configuration
public class MyConfiguration {

    @BindToRegistry
    public MyBean myAwesomeBean() {
        MyBean bean = new MyBean();
        // do something on bean
        return bean;
    }
}

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 map bean

When creating a bean as a java.util.Map type, then you can use the [] syntax as shown below:

camel.beans.myApp[id] = 123
camel.beans.myApp[name] = Demo App
camel.beans.myApp[version] = 1.0.1
camel.beans.myApp[username] = goofy

Camel will then create this as a LinkedHashMap type with the name myApp which is bound to the Camel Registry, with the data defined in the properties.

If you desire a different java.util.Map implementation, then you can use #class style as shown:

camel.beans.myApp = #class:com.foo.MyMapImplementation
camel.beans.myApp[id] = 123
camel.beans.myApp[name] = Demo App
camel.beans.myApp[version] = 1.0.1
camel.beans.myApp[username] = goofy

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.

Optional parameter values on beans

If a parameter value on a bean is configured using Property Placeholder and the placeholder is optional, then the placeholder can be marked as optional using ? syntax, as shown:

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

Then the company parameter is only set if there is a property placeholder with the key companyName (silent ignore if no option present).

Default parameter values on beans

It is possible to supply a default value (using :defaultValue) if the placeholder does not exist as shown:

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

Here the default value is Acme that will be used if there is no property placeholder with the key companyName.

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.

Using dots in Map keys

If the Map should contain keys with dots then the key must be quoted, as shown below using single quoted keys:

camel.beans.myldapserver['java.naming.provider.url'] = ldaps://ldap.local:636
camel.beans.myldapserver['java.naming.security.principal'] = scott
camel.beans.myldapserver['java.naming.security.credentials'] = tiger

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.