Camel Spring Boot

OpenFeature

Evaluate feature flags through the OpenFeature API, with flagd or any other OpenFeature provider.

What’s inside

Please refer to the above links for usage and configuration details.

Maven coordinates

<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-openfeature-starter</artifactId>
</dependency>

Spring Boot Auto-Configuration

The starter supports 19 options, which are listed below.

Name Description Default Type

camel.component.openfeature.autowired-enabled

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.

true

Boolean

camel.component.openfeature.cert-path

The path of a PEM file with the CA certificates that the TLS connection to the remote flagd service trusts, in place of the default trust store of the JVM. Used only when tls is true; a path to a file that does not exist is ignored.

String

camel.component.openfeature.configuration

The shared configuration of the endpoints: each endpoint starts with a copy of it. The option is a org.apache.camel.component.openfeature.OpenFeatureConfiguration type.

OpenFeatureConfiguration

camel.component.openfeature.context-from-body

Whether a Map message body is the evaluation context: its entries become the context attributes, and a targetingKey entry the targeting key. A body of another type is ignored. Not used when the CamelOpenFeatureEvaluationContext header (or an exchange property of that name) holds a Map, which takes precedence.

false

Boolean

camel.component.openfeature.deadline

The deadline in milliseconds of the flagd provider. When the endpoint starts, it waits up to twice this time for the provider to be ready (connected to the flagd service, or the flag definitions of flags or flagsResource loaded), and fails to start when it is not. With host, it is also the gRPC deadline of each flag evaluation call. Use a value greater than 0, and a higher value, such as 5000, when the start times out under load.

500

Integer

camel.component.openfeature.default-value

The default value that the evaluation returns when the flag cannot be evaluated, for example when the flag is not found, has another type, or the provider is not ready; the CamelOpenFeatureErrorCode header then holds the error code. For a boolean evaluation the text is parsed with Boolean.parseBoolean, so any value other than true (ignoring case) is false. When no evaluation type is set, true or false (ignoring case) selects a boolean evaluation, and any other value a string evaluation.

false

String

camel.component.openfeature.enabled

Whether to enable auto configuration of the openfeature component. This is enabled by default.

Boolean

camel.component.openfeature.evaluation-type

The type of flag evaluation, used when the endpoint URI has no evaluationType path: boolean and isEnabled both evaluate a boolean flag (Client.getBooleanDetails), and variant evaluates a string flag (Client.getStringDetails). The CamelOpenFeatureEvaluationType header overrides it. When no type is set, the type follows defaultValue.

String

camel.component.openfeature.flag-key

The flag key of the feature flag to evaluate. The CamelOpenFeatureFlagKey header (or an exchange property of that name) overrides it for a message. One of them must be set.

String

camel.component.openfeature.flags

The flag definitions in the flagd JSON format, given inline, for a flagd provider that evaluates the flags in this JVM. The JSON is written to a temporary file that the flagd provider reads in file mode. Used only when no provider bean is used. Cannot be combined with flagsResource, and host is ignored when it is set.

String

camel.component.openfeature.flags-resource

The location of a file with flag definitions in the flagd JSON format, for a flagd provider that evaluates the flags in this JVM. Any Camel resource location, such as classpath:flags.json or file:/etc/camel/flags.json. A file: location is read by the flagd provider itself, which reloads the file when it changes; other locations are read once when the endpoint starts. Used only when no provider bean is used. Cannot be combined with flags, and host is ignored when it is set.

String

camel.component.openfeature.host

The host name of a remote flagd service, which the flagd provider calls over gRPC for each flag evaluation. Used only when no provider bean is used and neither flags nor flagsResource is set.

String

camel.component.openfeature.lazy-start-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.

false

Boolean

camel.component.openfeature.port

The gRPC port of the remote flagd service set by host.

8013

Integer

camel.component.openfeature.provider

The name of a FeatureProvider bean in the registry that evaluates the flags (a leading # is optional). When not set, a FeatureProvider bean named flags is used when there is one, and otherwise the endpoint creates a flagd provider from flags, flagsResource or host. The flagd options do not apply to a provider bean.

String

camel.component.openfeature.result-property

The name of the exchange property that receives the flag value. When set, the message body is not changed; when not set, the flag value replaces the message body.

String

camel.component.openfeature.tls

Whether the gRPC connection to the remote flagd service set by host uses TLS. When false, the connection is plain text, unless the FLAGD_TLS environment variable enables TLS.

false

Boolean

camel.language.openfeature.enabled

Whether to enable auto configuration of the openfeature language. This is enabled by default.

Boolean

camel.language.openfeature.language

The name of the language to use.

String