This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 8d7bf426d764 CAMEL-27303: camel-openfeature - fix flaky
OpenFeatureLanguageTest (#30507)
8d7bf426d764 is described below
commit 8d7bf426d764c5267a80e6f2b0f947adeb139af9
Author: Aurélien Pupier <[email protected]>
AuthorDate: Tue Nov 24 13:35:34 2026 +0100
CAMEL-27303: camel-openfeature - fix flaky OpenFeatureLanguageTest (#30507)
The FlagdProvider for file/in-process resolvers internally uses
deadline * 2 as the initialization wait timeout. With the default of
500 ms this gives only a 1000 ms window, which was exceeded under
loaded CI agents (~36% flakiness rate).
Wire the existing 'deadline' configuration parameter through to the
file-based FlagdOptions builders (createFileProviderFromPath and
createFileProviderFromContent) so users can tune it. Previously it
was only applied to remote gRPC connections.
Set deadline=5000 in the tests (OpenFeatureLanguageTest and
OpenFeatureProducerTest) so the in-process provider gets a 10 s
initialization window, without changing the production default of
500 ms (which matches the upstream flagd default for gRPC).
Document the dual role of deadline in the @UriParam description,
openfeature-component.adoc (NOTE after flagsResource example), and
the 4.24 upgrade guide (including the FLAGD_DEADLINE_MS corollary).
Regenerate all generated files (openfeature.json, catalog adoc,
DSL builder factories).
Co-authored-by: IBM Bob 2.2.1
---
.../camel/catalog/components/openfeature.json | 4 +--
.../camel/catalog/docs/openfeature-component.adoc | 5 ++++
.../camel/component/openfeature/openfeature.json | 4 +--
.../src/main/docs/openfeature-component.adoc | 5 ++++
.../openfeature/OpenFeatureConfiguration.java | 8 ++++--
.../component/openfeature/OpenFeatureEndpoint.java | 2 ++
.../openfeature/OpenFeatureLanguageTest.java | 3 +++
.../openfeature/OpenFeatureProducerTest.java | 31 ++++++++++++----------
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 15 +++++++++++
.../dsl/OpenfeatureComponentBuilderFactory.java | 7 ++++-
.../dsl/OpenFeatureEndpointBuilderFactory.java | 14 ++++++++--
11 files changed, 75 insertions(+), 23 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/openfeature.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/openfeature.json
index 83a07daff5a6..2141ff9e49d8 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/openfeature.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/openfeature.json
@@ -26,7 +26,7 @@
"componentProperties": {
"configuration": { "index": 0, "kind": "property", "displayName":
"Configuration", "group": "producer", "label": "", "required": false, "type":
"object", "javaType":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"deprecated": false, "autowired": false, "secret": false, "description":
"Default configuration shared by OpenFeature endpoints." },
"contextFromBody": { "index": 1, "kind": "property", "displayName":
"Context From Body", "group": "common", "label": "common", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "When true, a Map message
body is used as the evaluation context. When false [...]
- "deadline": { "index": 2, "kind": "property", "displayName": "Deadline",
"group": "common", "label": "common", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 500, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "Deadline in milliseconds
for the remote flagd connection." },
+ "deadline": { "index": 2, "kind": "property", "displayName": "Deadline",
"group": "common", "label": "common", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 500, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "Deadline in
milliseconds. For remote flagd connections this is the gRPC deadline. For
file-based [...]
"defaultValue": { "index": 3, "kind": "property", "displayName": "Default
Value", "group": "common", "label": "common", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "false", "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "Default value when flag
evaluation fails. When evaluationType is not set [...]
"evaluationType": { "index": 4, "kind": "property", "displayName":
"Evaluation Type", "group": "common", "label": "common", "required": false,
"type": "enum", "javaType": "java.lang.String", "enum": [ "boolean", "variant",
"isEnabled" ], "deprecated": false, "autowired": false, "secret": false,
"configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "The evaluation type.
'boolean' and 'isEnabled' u [...]
"flagKey": { "index": 5, "kind": "property", "displayName": "Flag Key",
"group": "common", "label": "common", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "The feature flag key to
evaluate. Can be overridden per message via the CamelOpenFeatureFlagKey
header." },
@@ -58,7 +58,7 @@
"domain": { "index": 0, "kind": "path", "displayName": "Domain", "group":
"producer", "label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "The OpenFeature domain to bind the provider to." },
"evaluationType": { "index": 1, "kind": "path", "displayName": "Evaluation
Type", "group": "producer", "label": "", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "boolean", "variant", "isEnabled" ],
"deprecated": false, "autowired": false, "secret": false, "description": "The
evaluation type. 'boolean' and 'isEnabled' use boolean evaluation
(getBooleanValue). 'variant' uses string evaluation (getStringValue). When not
set, the type is inferred from defa [...]
"contextFromBody": { "index": 2, "kind": "parameter", "displayName":
"Context From Body", "group": "common", "label": "common", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "When true, a Map message
body is used as the evaluation context. When fals [...]
- "deadline": { "index": 3, "kind": "parameter", "displayName": "Deadline",
"group": "common", "label": "common", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 500, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "Deadline in milliseconds
for the remote flagd connection." },
+ "deadline": { "index": 3, "kind": "parameter", "displayName": "Deadline",
"group": "common", "label": "common", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 500, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "Deadline in
milliseconds. For remote flagd connections this is the gRPC deadline. For
file-based [...]
"defaultValue": { "index": 4, "kind": "parameter", "displayName": "Default
Value", "group": "common", "label": "common", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "false", "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "Default value when flag
evaluation fails. When evaluationType is not se [...]
"flagKey": { "index": 5, "kind": "parameter", "displayName": "Flag Key",
"group": "common", "label": "common", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "The feature flag key to
evaluate. Can be overridden per message via the CamelOpenFeatureFlagKey
header." },
"flags": { "index": 6, "kind": "parameter", "displayName": "Flags",
"group": "common", "label": "common", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "A JSON object defining
feature flags in flagd format (inline). Mutually exclusive with flagsResource."
},
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openfeature-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openfeature-component.adoc
index 1916772eb7bb..6469e94025aa 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openfeature-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openfeature-component.adoc
@@ -149,6 +149,11 @@ component to load them:
camel.component.openfeature.flags-resource = classpath:flags.json
----
+NOTE: For file-based providers (`flags` / `flagsResource`), the `deadline`
option controls
+the initialization wait timeout (internally `deadline * 2` ms). The default of
`500` ms is
+usually sufficient, but on heavily loaded machines or CI agents you may want
to raise it
+(e.g. `deadline=5000`).
+
=== Boolean flag (toggle / detour pattern)
A boolean flag enables or disables a feature. The flag definition declares
diff --git
a/components/camel-openfeature/src/generated/resources/META-INF/org/apache/camel/component/openfeature/openfeature.json
b/components/camel-openfeature/src/generated/resources/META-INF/org/apache/camel/component/openfeature/openfeature.json
index 83a07daff5a6..2141ff9e49d8 100644
---
a/components/camel-openfeature/src/generated/resources/META-INF/org/apache/camel/component/openfeature/openfeature.json
+++
b/components/camel-openfeature/src/generated/resources/META-INF/org/apache/camel/component/openfeature/openfeature.json
@@ -26,7 +26,7 @@
"componentProperties": {
"configuration": { "index": 0, "kind": "property", "displayName":
"Configuration", "group": "producer", "label": "", "required": false, "type":
"object", "javaType":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"deprecated": false, "autowired": false, "secret": false, "description":
"Default configuration shared by OpenFeature endpoints." },
"contextFromBody": { "index": 1, "kind": "property", "displayName":
"Context From Body", "group": "common", "label": "common", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "When true, a Map message
body is used as the evaluation context. When false [...]
- "deadline": { "index": 2, "kind": "property", "displayName": "Deadline",
"group": "common", "label": "common", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 500, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "Deadline in milliseconds
for the remote flagd connection." },
+ "deadline": { "index": 2, "kind": "property", "displayName": "Deadline",
"group": "common", "label": "common", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 500, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "Deadline in
milliseconds. For remote flagd connections this is the gRPC deadline. For
file-based [...]
"defaultValue": { "index": 3, "kind": "property", "displayName": "Default
Value", "group": "common", "label": "common", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "false", "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "Default value when flag
evaluation fails. When evaluationType is not set [...]
"evaluationType": { "index": 4, "kind": "property", "displayName":
"Evaluation Type", "group": "common", "label": "common", "required": false,
"type": "enum", "javaType": "java.lang.String", "enum": [ "boolean", "variant",
"isEnabled" ], "deprecated": false, "autowired": false, "secret": false,
"configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "The evaluation type.
'boolean' and 'isEnabled' u [...]
"flagKey": { "index": 5, "kind": "property", "displayName": "Flag Key",
"group": "common", "label": "common", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "The feature flag key to
evaluate. Can be overridden per message via the CamelOpenFeatureFlagKey
header." },
@@ -58,7 +58,7 @@
"domain": { "index": 0, "kind": "path", "displayName": "Domain", "group":
"producer", "label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "The OpenFeature domain to bind the provider to." },
"evaluationType": { "index": 1, "kind": "path", "displayName": "Evaluation
Type", "group": "producer", "label": "", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "boolean", "variant", "isEnabled" ],
"deprecated": false, "autowired": false, "secret": false, "description": "The
evaluation type. 'boolean' and 'isEnabled' use boolean evaluation
(getBooleanValue). 'variant' uses string evaluation (getStringValue). When not
set, the type is inferred from defa [...]
"contextFromBody": { "index": 2, "kind": "parameter", "displayName":
"Context From Body", "group": "common", "label": "common", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "When true, a Map message
body is used as the evaluation context. When fals [...]
- "deadline": { "index": 3, "kind": "parameter", "displayName": "Deadline",
"group": "common", "label": "common", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 500, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "Deadline in milliseconds
for the remote flagd connection." },
+ "deadline": { "index": 3, "kind": "parameter", "displayName": "Deadline",
"group": "common", "label": "common", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 500, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "Deadline in
milliseconds. For remote flagd connections this is the gRPC deadline. For
file-based [...]
"defaultValue": { "index": 4, "kind": "parameter", "displayName": "Default
Value", "group": "common", "label": "common", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "false", "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "Default value when flag
evaluation fails. When evaluationType is not se [...]
"flagKey": { "index": 5, "kind": "parameter", "displayName": "Flag Key",
"group": "common", "label": "common", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "The feature flag key to
evaluate. Can be overridden per message via the CamelOpenFeatureFlagKey
header." },
"flags": { "index": 6, "kind": "parameter", "displayName": "Flags",
"group": "common", "label": "common", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openfeature.OpenFeatureConfiguration",
"configurationField": "configuration", "description": "A JSON object defining
feature flags in flagd format (inline). Mutually exclusive with flagsResource."
},
diff --git
a/components/camel-openfeature/src/main/docs/openfeature-component.adoc
b/components/camel-openfeature/src/main/docs/openfeature-component.adoc
index 1916772eb7bb..6469e94025aa 100644
--- a/components/camel-openfeature/src/main/docs/openfeature-component.adoc
+++ b/components/camel-openfeature/src/main/docs/openfeature-component.adoc
@@ -149,6 +149,11 @@ component to load them:
camel.component.openfeature.flags-resource = classpath:flags.json
----
+NOTE: For file-based providers (`flags` / `flagsResource`), the `deadline`
option controls
+the initialization wait timeout (internally `deadline * 2` ms). The default of
`500` ms is
+usually sufficient, but on heavily loaded machines or CI agents you may want
to raise it
+(e.g. `deadline=5000`).
+
=== Boolean flag (toggle / detour pattern)
A boolean flag enables or disables a feature. The flag definition declares
diff --git
a/components/camel-openfeature/src/main/java/org/apache/camel/component/openfeature/OpenFeatureConfiguration.java
b/components/camel-openfeature/src/main/java/org/apache/camel/component/openfeature/OpenFeatureConfiguration.java
index 25cb9364a1d9..e3ac12c31dd7 100644
---
a/components/camel-openfeature/src/main/java/org/apache/camel/component/openfeature/OpenFeatureConfiguration.java
+++
b/components/camel-openfeature/src/main/java/org/apache/camel/component/openfeature/OpenFeatureConfiguration.java
@@ -58,7 +58,11 @@ public class OpenFeatureConfiguration implements Cloneable {
private String certPath;
@UriParam(label = "common", defaultValue = "500",
- description = "Deadline in milliseconds for the remote flagd
connection.")
+ description = "Deadline in milliseconds. For remote flagd
connections this is the gRPC deadline."
+ + " For file-based (in-process) providers this
controls the initialization wait timeout"
+ + " (internally used as deadline * 2). The default
of 500 ms matches the flagd upstream"
+ + " default for remote connections; for file-based
providers under load consider setting a"
+ + " higher value such as 5000.")
private int deadline = 500;
@UriParam(label = "common",
@@ -163,7 +167,7 @@ public class OpenFeatureConfiguration implements Cloneable {
return deadline;
}
- /** Deadline in milliseconds for the remote flagd connection. */
+ /** Deadline in milliseconds for the remote or file-based flagd provider.
*/
public void setDeadline(int deadline) {
this.deadline = deadline;
}
diff --git
a/components/camel-openfeature/src/main/java/org/apache/camel/component/openfeature/OpenFeatureEndpoint.java
b/components/camel-openfeature/src/main/java/org/apache/camel/component/openfeature/OpenFeatureEndpoint.java
index 5c186607b8f0..ac53b6620e8a 100644
---
a/components/camel-openfeature/src/main/java/org/apache/camel/component/openfeature/OpenFeatureEndpoint.java
+++
b/components/camel-openfeature/src/main/java/org/apache/camel/component/openfeature/OpenFeatureEndpoint.java
@@ -434,6 +434,7 @@ public class OpenFeatureEndpoint extends DefaultEndpoint {
FlagdOptions options = FlagdOptions.builder()
.resolverType(Config.Resolver.FILE)
.offlineFlagSourcePath(path)
+ .deadline(configuration.getDeadline())
.build();
return new FlagdProvider(options);
}
@@ -447,6 +448,7 @@ public class OpenFeatureEndpoint extends DefaultEndpoint {
FlagdOptions options = FlagdOptions.builder()
.resolverType(Config.Resolver.FILE)
.offlineFlagSourcePath(tmp.getAbsolutePath())
+ .deadline(configuration.getDeadline())
.build();
FlagdProvider provider = new FlagdProvider(options);
OpenFeatureComponent.ProviderRegistration reg
diff --git
a/components/camel-openfeature/src/test/java/org/apache/camel/component/openfeature/OpenFeatureLanguageTest.java
b/components/camel-openfeature/src/test/java/org/apache/camel/component/openfeature/OpenFeatureLanguageTest.java
index 040fcc2a4753..c2fbc76b82c1 100644
---
a/components/camel-openfeature/src/test/java/org/apache/camel/component/openfeature/OpenFeatureLanguageTest.java
+++
b/components/camel-openfeature/src/test/java/org/apache/camel/component/openfeature/OpenFeatureLanguageTest.java
@@ -80,6 +80,9 @@ class OpenFeatureLanguageTest extends CamelTestSupport {
CamelContext camelContext = super.createCamelContext();
OpenFeatureComponent component = new OpenFeatureComponent();
component.getConfiguration().setFlagsResource(FLAGS_RESOURCE);
+ // The in-process (file-based) provider waits deadline * 2 ms for
initialization;
+ // raise it so loaded CI agents don't hit the 1 s timeout that causes
the flakiness.
+ component.getConfiguration().setDeadline(5000);
camelContext.addComponent("openfeature", component);
return camelContext;
}
diff --git
a/components/camel-openfeature/src/test/java/org/apache/camel/component/openfeature/OpenFeatureProducerTest.java
b/components/camel-openfeature/src/test/java/org/apache/camel/component/openfeature/OpenFeatureProducerTest.java
index cb6af6e22d3b..b8077c0212a2 100644
---
a/components/camel-openfeature/src/test/java/org/apache/camel/component/openfeature/OpenFeatureProducerTest.java
+++
b/components/camel-openfeature/src/test/java/org/apache/camel/component/openfeature/OpenFeatureProducerTest.java
@@ -32,6 +32,9 @@ import static
org.assertj.core.api.Assertions.assertThatThrownBy;
class OpenFeatureProducerTest extends CamelTestSupport {
private static final String FLAGS_RESOURCE =
"classpath:openfeature/flags.json";
+ // The in-process (file-based) provider waits deadline * 2 ms for
initialization;
+ // raise it so loaded CI agents don't hit the 1 s timeout.
+ private static final String FILE_OPTS = "&deadline=5000";
@Override
protected RouteBuilder createRouteBuilder() {
@@ -39,44 +42,44 @@ class OpenFeatureProducerTest extends CamelTestSupport {
@Override
public void configure() {
from("direct:boolean-flag")
-
.to("openfeature:test?flagKey=enrichment-enabled&flagsResource=" +
FLAGS_RESOURCE);
+
.to("openfeature:test?flagKey=enrichment-enabled&flagsResource=" +
FLAGS_RESOURCE + FILE_OPTS);
from("direct:disabled-flag")
-
.to("openfeature:test-disabled?flagKey=disabled-flag&flagsResource=" +
FLAGS_RESOURCE);
+
.to("openfeature:test-disabled?flagKey=disabled-flag&flagsResource=" +
FLAGS_RESOURCE + FILE_OPTS);
from("direct:string-flag")
.to("openfeature:test-string?flagKey=new-routing-algorithm&defaultValue=unknown&flagsResource="
- + FLAGS_RESOURCE);
+ + FLAGS_RESOURCE + FILE_OPTS);
from("direct:result-property")
.to("openfeature:test-prop?flagKey=enrichment-enabled&resultProperty=flagResult&flagsResource="
- + FLAGS_RESOURCE);
+ + FLAGS_RESOURCE + FILE_OPTS);
from("direct:targeted-flag")
.to("openfeature:test-targeted?flagKey=hazmat-compliance-v2&defaultValue=v1&flagsResource="
+ FLAGS_RESOURCE
- + "&contextFromBody=true");
+ + "&contextFromBody=true" + FILE_OPTS);
from("direct:variant-type")
.to("openfeature:test-variant/variant?flagKey=new-routing-algorithm&flagsResource="
- + FLAGS_RESOURCE);
+ + FLAGS_RESOURCE + FILE_OPTS);
from("direct:boolean-type-explicit")
.to("openfeature:test-bool-type/boolean?flagKey=enrichment-enabled&flagsResource="
- + FLAGS_RESOURCE);
+ + FLAGS_RESOURCE + FILE_OPTS);
from("direct:is-enabled")
.to("openfeature:test-is-enabled/isEnabled?flagKey=enrichment-enabled&flagsResource="
- + FLAGS_RESOURCE);
+ + FLAGS_RESOURCE + FILE_OPTS);
from("direct:targeted-boolean")
.to("openfeature:test-targeted-bool?flagKey=targeted-boolean&flagsResource="
+ FLAGS_RESOURCE
- + "&contextFromBody=true");
+ + "&contextFromBody=true" + FILE_OPTS);
from("direct:targeted-boolean-header")
.to("openfeature:test-targeted-bool-hdr?flagKey=targeted-boolean&flagsResource="
- + FLAGS_RESOURCE);
+ + FLAGS_RESOURCE + FILE_OPTS);
}
};
}
@@ -199,7 +202,7 @@ class OpenFeatureProducerTest extends CamelTestSupport {
public void configure() {
from("direct:is-enabled-disabled")
.to("openfeature:test-is-enabled-off/isEnabled?flagKey=disabled-flag&flagsResource="
- + FLAGS_RESOURCE);
+ + FLAGS_RESOURCE + FILE_OPTS);
}
});
Object result = template.requestBody("direct:is-enabled-disabled",
"ignored");
@@ -225,7 +228,7 @@ class OpenFeatureProducerTest extends CamelTestSupport {
@Override
public void configure() {
from("direct:inline-flag")
-
.to("openfeature:test-inline?flagKey=inline-flag&flags=" + inlineFlags);
+
.to("openfeature:test-inline?flagKey=inline-flag&flags=" + inlineFlags +
FILE_OPTS);
}
});
Object result = template.requestBody("direct:inline-flag", "ignored");
@@ -287,7 +290,7 @@ class OpenFeatureProducerTest extends CamelTestSupport {
@Override
public void configure() {
from("direct:stale-header-test")
-
.to("openfeature:test-stale?flagKey=enrichment-enabled&flagsResource=" +
FLAGS_RESOURCE);
+
.to("openfeature:test-stale?flagKey=enrichment-enabled&flagsResource=" +
FLAGS_RESOURCE + FILE_OPTS);
}
});
@@ -347,7 +350,7 @@ class OpenFeatureProducerTest extends CamelTestSupport {
@Override
public void configure() {
from("direct:shared-domain")
-
.to("openfeature:shared?flagKey=enrichment-enabled&flagsResource=" +
FLAGS_RESOURCE);
+
.to("openfeature:shared?flagKey=enrichment-enabled&flagsResource=" +
FLAGS_RESOURCE + FILE_OPTS);
}
});
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index 561844eebbcc..26ddfa3f2d7a 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -9760,6 +9760,21 @@ Used as an expression, for example in `setBody`,
`setHeader` or `setProperty`, t
`defaultValue` of the endpoint as text (`false` unless set) and logged a
`TYPE_MISMATCH` warning. String flags give
their text as before, and number and object flags still give the
`defaultValue`. Predicates are unchanged.
+=== camel-openfeature - deadline option now applies to file-based providers
+
+The `deadline` option (default `500` ms) is now also passed to file-based
(in-process) `flagd` providers
+(`flags` and `flagsResource`), where it controls the initialization wait
timeout used internally as
+`deadline * 2`. Previously it was only applied to remote gRPC connections.
+
+If you use a file-based provider and see initialization timeouts under load,
raise the deadline on the
+endpoint or component (for example `deadline=5000`).
+
+If you previously relied on the `FLAGD_DEADLINE_MS` environment variable to
tune the initialization wait
+for file-based providers, switch to `deadline=NNNN` on the Camel endpoint or
component instead, as Camel
+now explicitly passes `deadline` to the file-based `FlagdOptions` and the
environment variable no longer
+takes effect for them.
+
+
=== camel-datasonnet - a null result and a stream body
An expression whose result is `null` now gives `null` instead of a `Document`
without content, unless `resultType` is
diff --git
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/OpenfeatureComponentBuilderFactory.java
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/OpenfeatureComponentBuilderFactory.java
index 62707c0905c5..8b3ebdf4a464 100644
---
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/OpenfeatureComponentBuilderFactory.java
+++
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/OpenfeatureComponentBuilderFactory.java
@@ -88,7 +88,12 @@ public interface OpenfeatureComponentBuilderFactory {
/**
- * Deadline in milliseconds for the remote flagd connection.
+ * Deadline in milliseconds. For remote flagd connections this is the
+ * gRPC deadline. For file-based (in-process) providers this controls
+ * the initialization wait timeout (internally used as deadline * 2).
+ * The default of 500 ms matches the flagd upstream default for remote
+ * connections; for file-based providers under load consider setting a
+ * higher value such as 5000.
*
* The option is a: <code>int</code> type.
*
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpenFeatureEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpenFeatureEndpointBuilderFactory.java
index 95b3d318e1ca..c018eff60bf6 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpenFeatureEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpenFeatureEndpointBuilderFactory.java
@@ -81,7 +81,12 @@ public interface OpenFeatureEndpointBuilderFactory {
return this;
}
/**
- * Deadline in milliseconds for the remote flagd connection.
+ * Deadline in milliseconds. For remote flagd connections this is the
+ * gRPC deadline. For file-based (in-process) providers this controls
+ * the initialization wait timeout (internally used as deadline * 2).
+ * The default of 500 ms matches the flagd upstream default for remote
+ * connections; for file-based providers under load consider setting a
+ * higher value such as 5000.
*
* The option is a: <code>int</code> type.
*
@@ -96,7 +101,12 @@ public interface OpenFeatureEndpointBuilderFactory {
return this;
}
/**
- * Deadline in milliseconds for the remote flagd connection.
+ * Deadline in milliseconds. For remote flagd connections this is the
+ * gRPC deadline. For file-based (in-process) providers this controls
+ * the initialization wait timeout (internally used as deadline * 2).
+ * The default of 500 ms matches the flagd upstream default for remote
+ * connections; for file-based providers under load consider setting a
+ * higher value such as 5000.
*
* The option will be converted to a <code>int</code> type.
*