75.4. Spring Boot Auto-Configuration
当将 ref 与 Spring Boot 搭配使用时,请确保使用以下 Maven 依赖项来支持自动配置:
<dependency> <groupId>org.apache.camel.springboot</groupId> <artifactId>camel-core-starter</artifactId> </dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-core-starter</artifactId>
</dependency>
组件支持 147 选项,如下所列。
名称 | 描述 | 默认 | 类型 |
---|---|---|---|
camel.cloud.consul.service-discovery.acl-token | 设置要与 Consul 一起使用的 ACL 令牌。 | 字符串 | |
camel.cloud.consul.service-discovery.block-seconds | 等待监视事件的秒数,默认为 10 秒。 | 10 | 整数 |
camel.cloud.consul.service-discovery.configurations | 定义其他配置定义。 | map | |
camel.cloud.consul.service-discovery.connect-timeout-millis | OkHttpClient 的连接超时。 | Long | |
camel.cloud.consul.service-discovery.datacenter | 数据中心。 | 字符串 | |
camel.cloud.consul.service-discovery.enabled | 启用组件。 | true | 布尔值 |
camel.cloud.consul.service-discovery.password | 设置用于基本身份验证的密码。 | 字符串 | |
camel.cloud.consul.service-discovery.properties | 设置要使用的客户端属性。这些属性特定于正在使用的服务调用实现。例如,如果使用 ribbon,则客户端属性在 com.netflix.client.config.CommonClientConfigKey 中定义。 | map | |
camel.cloud.consul.service-discovery.read-timeout-millis | OkHttpClient 的读取超时。 | Long | |
camel.cloud.consul.service-discovery.url | Consul 代理 URL。 | 字符串 | |
camel.cloud.consul.service-discovery.user-name | 设置用于基本身份验证的用户名。 | 字符串 | |
camel.cloud.consul.service-discovery.write-timeout-millis | OkHttpClient 的写入超时。 | Long | |
camel.cloud.dns.service-discovery.configurations | 定义其他配置定义。 | map | |
camel.cloud.dns.service-discovery.domain | 域名; | 字符串 | |
camel.cloud.dns.service-discovery.enabled | 启用组件。 | true | 布尔值 |
camel.cloud.dns.service-discovery.properties | 设置要使用的客户端属性。这些属性特定于正在使用的服务调用实现。例如,如果使用 ribbon,则客户端属性在 com.netflix.client.config.CommonClientConfigKey 中定义。 | map | |
camel.cloud.dns.service-discovery.proto | 所需服务的传输协议。 | _tcp | 字符串 |
camel.cloud.etcd.service-discovery.configurations | 定义其他配置定义。 | map | |
camel.cloud.etcd.service-discovery.enabled | 启用组件。 | true | 布尔值 |
camel.cloud.etcd.service-discovery.password | 用于基本身份验证的密码。 | 字符串 | |
camel.cloud.etcd.service-discovery.properties | 设置要使用的客户端属性。这些属性特定于正在使用的服务调用实现。例如,如果使用 ribbon,则客户端属性在 com.netflix.client.config.CommonClientConfigKey 中定义。 | map | |
camel.cloud.etcd.service-discovery.service-path | 用于查找服务发现的路径。 | /services/ | 字符串 |
camel.cloud.etcd.service-discovery.timeout | 要设置操作完成的最长时间。 | Long | |
camel.cloud.etcd.service-discovery.type | 要设置发现类型,有效的值为 on-demand 和 watch。 | 按需 | 字符串 |
camel.cloud.etcd.service-discovery.uris | 客户端可以连接的 URI。 | 字符串 | |
camel.cloud.etcd.service-discovery.user-name | 用于基本身份验证的用户名。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.api-version | 使用客户端查找时设置 API 版本。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.ca-cert-data | 使用客户端查找时设置证书颁发机构数据。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.ca-cert-file | 设置在使用客户端查找时从文件加载的证书颁发机构数据。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.client-cert-data | 使用客户端查找时设置客户端证书数据。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.client-cert-file | 设置在使用客户端查找时从文件加载的客户端证书数据。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.client-key-algo | 在使用客户端查找时设置客户端密钥存储算法,如 RSA。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.client-key-data | 在使用客户端查找时设置 Client Keystore 数据。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.client-key-file | 设置在使用客户端查找时从文件加载的客户端密钥存储数据。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.client-key-passphrase | 在使用客户端查找时设置客户端密钥存储密码短语。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.configurations | 定义其他配置定义。 | map | |
camel.cloud.kubernetes.service-discovery.dns-domain | 设置用于 DNS 查找的 DNS 域。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.enabled | 启用组件。 | true | 布尔值 |
camel.cloud.kubernetes.service-discovery.lookup | 如何执行服务查找。可能的值: client, dns, environment。在使用客户端时,客户端查询 kubernetes master 以获取提供服务的活动 pod 列表,然后随机(或循环)选择一个 pod。使用 dns 时,服务名称被解析为 name.namespace.svc.dnsDomain。当使用 dnssrv 时,使用 SRV 查询来解析 服务名称。…svc…在使用环境时,环境变量用于查找服务。默认情况下使用环境。 | 环境 | 字符串 |
camel.cloud.kubernetes.service-discovery.master-url | 使用客户端查找时,将 URL 设置为 master。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.namespace | 设置要使用的命名空间。默认情况下,将使用 ENV 变量 KUBERNETES_MASTER 中的 namespace。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.oauth-token | 在使用客户端查找时,设置用于身份验证的 OAUTH 令牌(而不是用户名/密码)。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.password | 在使用客户端查找时,设置用于身份验证的密码。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.port-name | 设置 DNS/DNSSRV 查找时使用的端口名称。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.port-protocol | 设置用于 DNS/DNSSRV 查找的端口协议。 | 字符串 | |
camel.cloud.kubernetes.service-discovery.properties | 设置要使用的客户端属性。这些属性特定于正在使用的服务调用实现。例如,如果使用 ribbon,则客户端属性在 com.netflix.client.config.CommonClientConfigKey 中定义。 | map | |
camel.cloud.kubernetes.service-discovery.trust-certs | 设置在使用客户端查找时是否打开信任证书检查。 | false | 布尔值 |
camel.cloud.kubernetes.service-discovery.username | 在使用客户端查找时,设置用于身份验证的用户名。 | 字符串 | |
camel.cloud.ribbon.load-balancer.client-name | 设置 Ribbon 客户端名称。 | 字符串 | |
camel.cloud.ribbon.load-balancer.configurations | 定义其他配置定义。 | map | |
camel.cloud.ribbon.load-balancer.enabled | 启用组件。 | true | 布尔值 |
camel.cloud.ribbon.load-balancer.namespace | 命名空间。 | 字符串 | |
camel.cloud.ribbon.load-balancer.password | 密码。 | 字符串 | |
camel.cloud.ribbon.load-balancer.properties | 设置要使用的客户端属性。这些属性特定于正在使用的服务调用实现。例如,如果使用 ribbon,则客户端属性在 com.netflix.client.config.CommonClientConfigKey 中定义。 | map | |
camel.cloud.ribbon.load-balancer.username | 用户名。 | 字符串 | |
camel.hystrix.allow-maximum-size-to-diverge-from-core-size | 允许配置 maximumSize 生效。然后该值可以等于或大于 coreSize。 | false | 布尔值 |
camel.hystrix.circuit-breaker-enabled | 是否使用 HystrixCircuitBreaker。如果为 false,则将使用 断路器 逻辑,并且允许的所有请求。这与 circuitBreakerForceClosed ()类似,除了继续跟踪指标并知道它是否应该处于打开/关闭状态外,此属性也不会实例化断路器。 | true | 布尔值 |
camel.hystrix.circuit-breaker-error-threshold-percentage | 错误百分比阈值(如 50)指向断路器将开放和拒绝请求。它将保持在 circuitBreakerSleepWindowInMilliseconds 中定义的持续时间;与 HystrixCommandMetrics.getHealthCounts ()进行比较的错误百分比。 | 50 | 整数 |
camel.hystrix.circuit-breaker-force-closed | 如果为 true,HystrixCircuitBreaker#allowRequest ()将始终返回 true 以允许请求,而不考虑 HystrixCommandMetrics.getHealthCounts ()中的错误百分比。circuitBreakerForceOpen ()属性具有优先权,因此如果设为 true,则此属性不会执行。 | false | 布尔值 |
camel.hystrix.circuit-breaker-force-open | 如果为 true,HystrixCircuitBreaker.allowRequest ()将始终返回 false,从而导致电路变为开路(条带)并拒绝所有请求。此属性优先于 circuitBreakerForceClosed ();。 | false | 布尔值 |
camel.hystrix.circuit-breaker-request-volume-threshold | 指标RollingStatisticalWindowInMilliseconds ()中必须存在于 HystrixCircuitBreaker 的最小请求数。如果在这个数量下,无论错误百分比如何,电路不会条带化。 | 20 | 整数 |
camel.hystrix.circuit-breaker-sleep-window-in-milliseconds | HystrixCircuitBreakertrips 打开 HystrixCircuitBreaker 往返时间(以毫秒为单位),在尝试请求前应等待的时间(毫秒)。 | 5000 | 整数 |
camel.hystrix.configurations | 定义其他配置定义。 | map | |
camel.hystrix.core-pool-size | 传递给 java.util.concurrent.ThreadPoolExecutor#setCorePoolSize (int)的核心 thread-pool 大小。 | 10 | 整数 |
camel.hystrix.enabled | 启用组件。 | true | 布尔值 |
camel.hystrix.execution-isolation-semaphore-max-concurrent-requests | 允许 HystrixCommand.run ()的并发请求数。超出并发限制的请求将被拒绝。Applicable only when executionIsolationStrategy == SEMAPHORE. | 20 | 整数 |
camel.hystrix.execution-isolation-strategy | 将通过以下方式执行哪些隔离策略 HystrixCommand.run ():如果 THREAD,它将在单独的线程上执行,并且并发请求受 thread-pool 中的线程数量限制。如果 SEMAPHORE,它将在调用线程上执行,并且由 semaphore 数限制的并发请求。 | 线程 | 字符串 |
camel.hystrix.execution-isolation-thread-interrupt-on-timeout | 当线程超时时,执行线程是否应该尝试中断(使用 Future# canceled )。仅在 executionIsolationStrategy ()== THREAD 时才适用。 | true | 布尔值 |
camel.hystrix.execution-timeout-enabled | 此命令是否启用了超时机制。 | true | 布尔值 |
camel.hystrix.execution-timeout-in-milliseconds | 命令超时并停止执行的时间(以毫秒为单位)。如果 executionIsolationThreadInterruptOnTimeout == true 并且命令是 thread-isolated,则执行线程将中断。如果命令是 semaphore-isolated 和 HystrixObservableCommand,则该命令将被取消订阅。 | 1000 | 整数 |
camel.hystrix.fallback-enabled | 出现故障时是否应该尝试 HystrixCommand.getFallback ()。 | true | 布尔值 |
camel.hystrix.fallback-isolation-semaphore-max-concurrent-requests | 允许 HystrixCommand.getFallback ()的并发请求数。超出并发限制的请求将很快失败,且不会尝试检索回退。 | 10 | 整数 |
camel.hystrix.group-key | 设置要使用的组密钥。默认值为 CamelHystrix。 | CamelHystrix | 字符串 |
camel.hystrix.keep-alive-time | keep-alive 时间(以分钟为单位)传递给 ThreadPoolExecutor#setKeepAliveTime (long,TimeUnit)。 | 1 | 整数 |
camel.hystrix.max-queue-size | 在 HystrixConcurrencyStrategy.getBlockingQueue (int)中传递给 BlockingQueue 的最大队列大小应该只影响 threadpool 的实例化 - 它不会意外地更改队列大小。为此,请使用 queueSizeRejectionThreshold ()。 | -1 | 整数 |
camel.hystrix.maximum-size | Maximum thread-pool size that gets passed to ThreadPoolExecutor#setMaximumPoolSize(int) .这是在没有开始拒绝 HystrixCommands 的情况下支持的最大并发数。请注意,只有在您还设置了 allowMaximumSizeToDivergeFromCoreSize 时,此设置才会生效。 | 10 | 整数 |
camel.hystrix.metrics-health-snapshot-interval-in-milliseconds | 允许计算成功和错误百分比并影响 HystrixCircuitBreaker.isOpen ()状态的健康快照之间等待的时间(毫秒)。在高容量电路上,错误百分比的持续计算可能会成为 CPU 密集型,从而控制它计算的频率。 | 500 | 整数 |
camel.hystrix.metrics-rolling-percentile-bucket-size | 存储在滚动百分比的每个存储桶中的最大值数。这传递到 HystrixRollingPercentile in HystrixCommandMetrics。 | 10 | 整数 |
camel.hystrix.metrics-rolling-percentile-enabled | 是否应该使用 HystrixRollingPercentile 在 HystrixCommandMetrics 中捕获百分比的指标。 | true | 布尔值 |
camel.hystrix.metrics-rolling-percentile-window-buckets | 滚动百分比窗口的 bucket 数量已分为.这传递到 HystrixRollingPercentile in HystrixCommandMetrics。 | 6 | 整数 |
camel.hystrix.metrics-rolling-percentile-window-in-milliseconds | 以毫秒为单位的百分比滚动窗口。这传递到 HystrixRollingPercentile in HystrixCommandMetrics。 | 10000 | 整数 |
camel.hystrix.metrics-rolling-statistical-window-buckets | 滚动统计窗口的 bucket 数量已分为.这传递到 HystrixCommandMetrics 中的 HystrixRollingNumber。 | 10 | 整数 |
camel.hystrix.metrics-rolling-statistical-window-in-milliseconds | 此属性设置统计滚动窗口的持续时间,以毫秒为单位。这是为线程池保留指标的时间。窗口被分成 bucket,按这些递增来滚动。 | 10000 | 整数 |
camel.hystrix.queue-size-rejection-threshold | 队列大小拒绝阈值是一个人为最大大小,即使未达到 maxQueueSize,也会发生拒绝的大小。这是因为 BlockingQueue 的 maxQueueSize 无法动态更改,我们希望支持动态更改会影响拒绝的队列大小。在排队线程执行时,HystrixCommand 使用它。 | 5 | 整数 |
camel.hystrix.request-log-enabled | HystrixCommand 执行和事件是否应记录到 HystrixRequestLog。 | true | 布尔值 |
camel.hystrix.thread-pool-key | 设置要使用的线程池密钥。默认情况下,将使用与 groupKey 相同的值。 | CamelHystrix | 字符串 |
camel.hystrix.thread-pool-rolling-number-statistical-window-buckets | 滚动统计窗口的 bucket 数量已分为.这会传递给每个 HystrixThreadPoolMetrics 实例内的 HystrixRollingNumber。 | 10 | 整数 |
camel.hystrix.thread-pool-rolling-number-statistical-window-in-milliseconds | 统计滚动窗口的持续时间(以毫秒为单位)。这会传递给每个 HystrixThreadPoolMetrics 实例内的 HystrixRollingNumber。 | 10000 | 整数 |
camel.language.constant.enabled | 是否启用恒定语言的自动配置。这默认是启用的。 | 布尔值 | |
camel.language.constant.trim | 是否修剪值以移除前导和尾随空格和换行符。 | true | 布尔值 |
camel.language.csimple.enabled | 是否启用 csimple 语言的自动配置。这默认是启用的。 | 布尔值 | |
camel.language.csimple.trim | 是否修剪值以移除前导和尾随空格和换行符。 | true | 布尔值 |
camel.language.exchangeproperty.enabled | 是否启用 ExchangeProperty 语言自动配置。这默认是启用的。 | 布尔值 | |
camel.language.exchangeproperty.trim | 是否修剪值以移除前导和尾随空格和换行符。 | true | 布尔值 |
camel.language.file.enabled | 是否启用文件语言的自动配置。这默认是启用的。 | 布尔值 | |
camel.language.file.trim | 是否修剪值以移除前导和尾随空格和换行符。 | true | 布尔值 |
camel.language.header.enabled | 是否启用标头语言的自动配置。这默认是启用的。 | 布尔值 | |
camel.language.header.trim | 是否修剪值以移除前导和尾随空格和换行符。 | true | 布尔值 |
camel.language.ref.enabled | 是否启用 ref 语言的自动配置。这默认是启用的。 | 布尔值 | |
camel.language.ref.trim | 是否修剪值以移除前导和尾随空格和换行符。 | true | 布尔值 |
camel.language.simple.enabled | 是否启用简单语言的自动配置。这默认是启用的。 | 布尔值 | |
camel.language.simple.trim | 是否修剪值以移除前导和尾随空格和换行符。 | true | 布尔值 |
camel.language.tokenize.enabled | 是否启用令牌语言的自动配置。这默认是启用的。 | 布尔值 | |
camel.language.tokenize.group-delimiter | 设置分组时要使用的分隔符。如果没有设置,则令牌将用作分隔符。 | 字符串 | |
camel.language.tokenize.trim | 是否修剪值以移除前导和尾随空格和换行符。 | true | 布尔值 |
camel.resilience4j.automatic-transition-from-open-to-half-open-enabled | 在 waitDurationInOpenState 通过后,启用从 OPEN 自动过渡到 HALF_OPEN 状态。 | false | 布尔值 |
camel.resilience4j.circuit-breaker-ref | 代表现有的 io.github.resilience4j.circuitbreaker.CircuitBreaker 实例,以便从 registry 查找和使用。在使用它时,不使用任何其他断路器选项。 | 字符串 | |
camel.resilience4j.config-ref | 代表现有的 io.github.resilience4j.circuitbreaker.CircuitBreakerConfig 实例,用于从 registry 查找和使用。 | 字符串 | |
camel.resilience4j.configurations | 定义其他配置定义。 | map | |
camel.resilience4j.enabled | 启用组件。 | true | 布尔值 |
camel.resilience4j.failure-rate-threshold | 配置故障率阈值(以百分比表示)。如果失败率相等或大于 CircuitBreaker 转换的阈值,并启动短路调用。阈值必须大于 0,且不能超过 100。默认值为 50 个百分比。 | 浮点值 | |
camel.resilience4j.minimum-number-of-calls | 配置 CircuitBreaker 可以计算错误率前所需的最少调用数(每个滑动窗口期限)。例如,如果 minimumNumberOfCalls 为 10,则必须记录至少 10 个调用,然后才能计算失败率。如果只记录 9 个调用,则 CircuitBreaker 不会过渡到 open,即使所有 9 调用都失败。 | 100 | 整数 |
camel.resilience4j.permitted-number-of-calls-in-half-open-state |
| 10 | 整数 |
camel.resilience4j.sliding-window-size |
| 100 | 整数 |
camel.resilience4j.sliding-window-type |
| COUNT_BASED | 字符串 |
camel.resilience4j.slow-call-duration-threshold |
| 60 | 整数 |
camel.resilience4j.slow-call-rate-threshold |
| 浮点值 | |
camel.resilience4j.wait-duration-in-open-state |
| 60 | 整数 |
camel.resilience4j.writable-stack-trace-enabled |
| true | 布尔值 |
camel.rest.api-component |
| 字符串 | |
camel.rest.api-context-path |
| 字符串 | |
camel.rest.api-context-route-id |
| 字符串 | |
camel.rest.api-host |
| 字符串 | |
camel.rest.api-property |
|
| |
camel.rest.api-vendor-extension |
| false | 布尔值 |
camel.rest.binding-mode |
| RestBindingMode | |
camel.rest.client-request-validation |
| false | 布尔值 |
camel.rest.component |
| 字符串 | |
camel.rest.component-property |
|
| |
camel.rest.consumer-property |
|
| |
camel.rest.context-path |
| 字符串 | |
camel.rest.cors-headers |
|
| |
camel.rest.data-format-property |
|
| |
camel.rest.enable-cors |
| false | 布尔值 |
camel.rest.endpoint-property |
|
| |
camel.rest.host |
| 字符串 | |
camel.rest.host-name-resolver |
| RestHostNameResolver | |
camel.rest.json-data-format |
| 字符串 | |
camel.rest.port |
| 字符串 | |
camel.rest.producer-api-doc |
| 字符串 | |
camel.rest.producer-component |
| 字符串 | |
camel.rest.scheme |
| 字符串 | |
camel.rest.skip-binding-on-error-code |
| false | 布尔值 |
camel.rest.use-x-forward-headers | 默认值为 true。 | true | 布尔值 |
camel.rest.xml-data-format |
| 字符串 | |
camel.rest.api-context-id-pattern |
| 字符串 | |
camel.rest.api-context-listing |
| false | 布尔值 |