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 ad349062ac5d CAMEL-26836: Reload validated WASM policy snapshots 
atomically (#29831)
ad349062ac5d is described below

commit ad349062ac5d01cd0d8b3389a05a9418e01d3457
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue Nov 17 11:18:26 2026 +0100

    CAMEL-26836: Reload validated WASM policy snapshots atomically (#29831)
    
    * CAMEL-26836: Reload validated WASM policy snapshots atomically
    * CAMEL-26836: One validation for WASM options, a poll that survives errors 
and skips known-bad content, a status that keeps the last failure, and a 
route-level reload test
    * CAMEL-26836: Remember content that failed validation too, give create its 
Javadoc back, and document reloadPolicy on the policy
    * CAMEL-26836: Route inputExpression through the reloading evaluator, 
remember an Error from the factory too, and say that create builds a 
non-reloading evaluator
    
    Co-Authored-By: Claude Fable 5.1 <[email protected]>
    Co-authored-by: Codex <[email protected]>
---
 .../camel/catalog/beans/OpaSecurityPolicy.json     |   2 +-
 .../org/apache/camel/catalog/components/opa.json   |  28 +-
 .../apache/camel/catalog/docs/opa-component.adoc   |  33 ++
 .../component/opa/OpaComponentConfigurer.java      |   6 +
 .../camel/component/opa/OpaEndpointConfigurer.java |   6 +
 .../camel/component/opa/OpaEndpointUriFactory.java |   3 +-
 .../opa/security/OpaSecurityPolicyConfigurer.java  |   6 +
 .../org/apache/camel/component/opa/opa.json        |  28 +-
 .../org/apache/camel/bean/OpaSecurityPolicy.json   |   2 +-
 .../camel-opa/src/main/docs/opa-component.adoc     |  33 ++
 .../camel/component/opa/OpaConfiguration.java      |  15 +
 .../apache/camel/component/opa/OpaEndpoint.java    |  25 +-
 .../camel/component/opa/OpaPolicyReloadStatus.java |  66 ++++
 .../component/opa/OpaReloadableWasmEvaluator.java  | 344 +++++++++++++++++
 .../camel/component/opa/OpaWasmEvaluator.java      |  29 +-
 .../component/opa/security/OpaSecurityPolicy.java  |  43 ++-
 .../opa/OpaReloadableWasmEvaluatorTest.java        | 411 +++++++++++++++++++++
 .../org/apache/camel/component/opa/OpaWasmIT.java  |  96 +++++
 .../opa/security/OpaSecurityPolicyWasmTest.java    |   3 +-
 .../component/dsl/OpaComponentBuilderFactory.java  |  21 ++
 .../endpoint/dsl/OpaEndpointBuilderFactory.java    |  36 ++
 21 files changed, 1191 insertions(+), 45 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/OpaSecurityPolicy.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/OpaSecurityPolicy.json
index e63c588ce2ee..9e118e8397f5 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/OpaSecurityPolicy.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/OpaSecurityPolicy.json
@@ -10,7 +10,7 @@
     "groupId": "org.apache.camel",
     "artifactId": "camel-opa",
     "version": "4.24.0-SNAPSHOT",
-    "properties": { "serverUrl": { "index": 0, "kind": "property", 
"displayName": "Server Url", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "http:\/\/localhost:8181", "description": "The base URL of the 
OPA server, without the \/v1\/data suffix. Not used in wasm mode." }, 
"policyPath": { "index": 1, "kind": "property", "displayName": "Policy Path", 
"required": true, "type": "string", "javaT [...]
+    "properties": { "serverUrl": { "index": 0, "kind": "property", 
"displayName": "Server Url", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "http:\/\/localhost:8181", "description": "The base URL of the 
OPA server, without the \/v1\/data suffix. Not used in wasm mode." }, 
"policyPath": { "index": 1, "kind": "property", "displayName": "Policy Path", 
"required": true, "type": "string", "javaT [...]
   }
 }
 
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/opa.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/opa.json
index 5d41c69a2137..e1c4a23faf51 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/opa.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/opa.json
@@ -41,14 +41,15 @@
     "healthCheckBundles": { "index": 14, "kind": "property", "displayName": 
"Health Check Bundles", "group": "advanced", "label": "advanced", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": "org.apache.camel.component.opa.OpaConfiguration", 
"configurationField": "configuration", "description": "Whether the server 
readiness check also requires activation of OPA's configured  [...]
     "inputExpression": { "index": 15, "kind": "property", "displayName": 
"Input Expression", "group": "advanced", "label": "advanced", "required": 
false, "type": "object", "javaType": "org.apache.camel.Expression", 
"deprecated": false, "autowired": false, "secret": false, 
"supportSimpleExpression": true, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "An expression producing the complete policy 
input as a Map [...]
     "opaClient": { "index": 16, "kind": "property", "displayName": "Opa 
Client", "group": "advanced", "label": "advanced", "required": false, "type": 
"object", "javaType": "com.styra.opa.OPAClient", "deprecated": false, 
"autowired": true, "secret": false, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "An existing OPAClient to use. When set, 
serverUrl and bearerToken are ignored." },
-    "poolSize": { "index": 17, "kind": "property", "displayName": "Pool Size", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 8, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How many WebAssembly policy instances to pool 
in wasm mode. An instance carries mutable state and is not thre [...]
-    "requestTimeout": { "index": 18, "kind": "property", "displayName": 
"Request Timeout", "group": "advanced", "label": "advanced", "required": false, 
"type": "duration", "javaType": "long", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "30000", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How long to wait for the decision once 
connected, in rest mode. A request that times out  [...]
-    "healthCheckConsumerEnabled": { "index": 19, "kind": "property", 
"displayName": "Health Check Consumer Enabled", "group": "health", "label": 
"health", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Used for enabling or disabling all consumer based health checks 
from this component" },
-    "healthCheckProducerEnabled": { "index": 20, "kind": "property", 
"displayName": "Health Check Producer Enabled", "group": "health", "label": 
"health", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Used for enabling or disabling all producer based health checks 
from this component. Notice: Camel has by default disabled all producer based 
health-checks. You can turn on produce [...]
-    "bearerToken": { "index": 21, "kind": "property", "displayName": "Bearer 
Token", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "Bearer token sent to the OPA server in the 
Authorization header, for an OPA instance that [...]
-    "failOpen": { "index": 22, "kind": "property", "displayName": "Fail Open", 
"group": "security", "label": "security", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "autowired": false, "secret": 
false, "security": "insecure:dev", "defaultValue": false, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "Whether to allow the exchange to proceed when 
the policy decision point i [...]
-    "sslContextParameters": { "index": 23, "kind": "property", "displayName": 
"Ssl Context Parameters", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "TLS configuration for the connection to the 
OPA server in [...]
-    "useGlobalSslContextParameters": { "index": 24, "kind": "property", 
"displayName": "Use Global Ssl Context Parameters", "group": "security", 
"label": "security", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Enable usage of global SSL context 
parameters." }
+    "policyReloadInterval": { "index": 17, "kind": "property", "displayName": 
"Policy Reload Interval", "group": "advanced", "label": "advanced", "required": 
false, "type": "duration", "javaType": "long", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": "0", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How often, in milliseconds, to check the 
configured WASM resource for changed po [...]
+    "poolSize": { "index": 18, "kind": "property", "displayName": "Pool Size", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 8, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How many WebAssembly policy instances to pool 
in wasm mode. An instance carries mutable state and is not thre [...]
+    "requestTimeout": { "index": 19, "kind": "property", "displayName": 
"Request Timeout", "group": "advanced", "label": "advanced", "required": false, 
"type": "duration", "javaType": "long", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "30000", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How long to wait for the decision once 
connected, in rest mode. A request that times out  [...]
+    "healthCheckConsumerEnabled": { "index": 20, "kind": "property", 
"displayName": "Health Check Consumer Enabled", "group": "health", "label": 
"health", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Used for enabling or disabling all consumer based health checks 
from this component" },
+    "healthCheckProducerEnabled": { "index": 21, "kind": "property", 
"displayName": "Health Check Producer Enabled", "group": "health", "label": 
"health", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Used for enabling or disabling all producer based health checks 
from this component. Notice: Camel has by default disabled all producer based 
health-checks. You can turn on produce [...]
+    "bearerToken": { "index": 22, "kind": "property", "displayName": "Bearer 
Token", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "Bearer token sent to the OPA server in the 
Authorization header, for an OPA instance that [...]
+    "failOpen": { "index": 23, "kind": "property", "displayName": "Fail Open", 
"group": "security", "label": "security", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "autowired": false, "secret": 
false, "security": "insecure:dev", "defaultValue": false, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "Whether to allow the exchange to proceed when 
the policy decision point i [...]
+    "sslContextParameters": { "index": 24, "kind": "property", "displayName": 
"Ssl Context Parameters", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "TLS configuration for the connection to the 
OPA server in [...]
+    "useGlobalSslContextParameters": { "index": 25, "kind": "property", 
"displayName": "Use Global Ssl Context Parameters", "group": "security", 
"label": "security", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Enable usage of global SSL context 
parameters." }
   },
   "headers": {
     "CamelOpaDecisionAllow": { "index": 0, "kind": "header", "displayName": 
"", "group": "producer", "label": "producer", "required": false, "javaType": 
"Boolean", "deprecated": false, "autowired": false, "secret": false, 
"description": "The allow\/deny verdict of the policy evaluation. Always 
overwritten by the component, so a value set by an inbound message never 
survives into the route.", "constantName": 
"org.apache.camel.component.opa.OpaConstants#DECISION_ALLOW" },
@@ -79,10 +80,11 @@
     "healthCheckBundles": { "index": 13, "kind": "parameter", "displayName": 
"Health Check Bundles", "group": "advanced", "label": "advanced", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": "org.apache.camel.component.opa.OpaConfiguration", 
"configurationField": "configuration", "description": "Whether the server 
readiness check also requires activation of OPA's configured [...]
     "inputExpression": { "index": 14, "kind": "parameter", "displayName": 
"Input Expression", "group": "advanced", "label": "advanced", "required": 
false, "type": "object", "javaType": "org.apache.camel.Expression", 
"deprecated": false, "autowired": false, "secret": false, 
"supportSimpleExpression": true, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "An expression producing the complete policy 
input as a Ma [...]
     "opaClient": { "index": 15, "kind": "parameter", "displayName": "Opa 
Client", "group": "advanced", "label": "advanced", "required": false, "type": 
"object", "javaType": "com.styra.opa.OPAClient", "deprecated": false, 
"autowired": true, "secret": false, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "An existing OPAClient to use. When set, 
serverUrl and bearerToken are ignored." },
-    "poolSize": { "index": 16, "kind": "parameter", "displayName": "Pool 
Size", "group": "advanced", "label": "advanced", "required": false, "type": 
"integer", "javaType": "int", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": 8, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How many WebAssembly policy instances to pool 
in wasm mode. An instance carries mutable state and is not thr [...]
-    "requestTimeout": { "index": 17, "kind": "parameter", "displayName": 
"Request Timeout", "group": "advanced", "label": "advanced", "required": false, 
"type": "duration", "javaType": "long", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "30000", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How long to wait for the decision once 
connected, in rest mode. A request that times out [...]
-    "bearerToken": { "index": 18, "kind": "parameter", "displayName": "Bearer 
Token", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "Bearer token sent to the OPA server in the 
Authorization header, for an OPA instance tha [...]
-    "failOpen": { "index": 19, "kind": "parameter", "displayName": "Fail 
Open", "group": "security", "label": "security", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "security": "insecure:dev", "defaultValue": false, 
"configurationClass": "org.apache.camel.component.opa.OpaConfiguration", 
"configurationField": "configuration", "description": "Whether to allow the 
exchange to proceed when the policy decision point  [...]
-    "sslContextParameters": { "index": 20, "kind": "parameter", "displayName": 
"Ssl Context Parameters", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "TLS configuration for the connection to the 
OPA server i [...]
+    "policyReloadInterval": { "index": 16, "kind": "parameter", "displayName": 
"Policy Reload Interval", "group": "advanced", "label": "advanced", "required": 
false, "type": "duration", "javaType": "long", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": "0", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How often, in milliseconds, to check the 
configured WASM resource for changed p [...]
+    "poolSize": { "index": 17, "kind": "parameter", "displayName": "Pool 
Size", "group": "advanced", "label": "advanced", "required": false, "type": 
"integer", "javaType": "int", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": 8, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How many WebAssembly policy instances to pool 
in wasm mode. An instance carries mutable state and is not thr [...]
+    "requestTimeout": { "index": 18, "kind": "parameter", "displayName": 
"Request Timeout", "group": "advanced", "label": "advanced", "required": false, 
"type": "duration", "javaType": "long", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "30000", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How long to wait for the decision once 
connected, in rest mode. A request that times out [...]
+    "bearerToken": { "index": 19, "kind": "parameter", "displayName": "Bearer 
Token", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "Bearer token sent to the OPA server in the 
Authorization header, for an OPA instance tha [...]
+    "failOpen": { "index": 20, "kind": "parameter", "displayName": "Fail 
Open", "group": "security", "label": "security", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "security": "insecure:dev", "defaultValue": false, 
"configurationClass": "org.apache.camel.component.opa.OpaConfiguration", 
"configurationField": "configuration", "description": "Whether to allow the 
exchange to proceed when the policy decision point  [...]
+    "sslContextParameters": { "index": 21, "kind": "parameter", "displayName": 
"Ssl Context Parameters", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "TLS configuration for the connection to the 
OPA server i [...]
   }
 }
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/opa-component.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/opa-component.adoc
index 5a6920987e40..5d37f259b00d 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/opa-component.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/opa-component.adoc
@@ -682,6 +682,39 @@ shared concurrently. An evaluation failure discards the 
instance, and its replac
 entrypoint and data before use. Large static data therefore adds 
initialization work per instance, rather than
 being parsed again for every exchange.
 
+=== Reloading a WASM policy
+
+A WASM endpoint or security policy keeps the policy module and its bundled 
data together as one immutable
+snapshot. By default it loads the configured resource at startup only. Set 
`policyReloadInterval` to a
+positive duration in milliseconds to poll that resource using a Camel-managed 
scheduler, for example:
+
+[source,java]
+----
+.to("opa:authz/allow?evaluationMode=wasm&policyBundle=file:/etc/policies/bundle.tar.gz&policyReloadInterval=5000")
+----
+
+The same `policyReloadInterval` property is available on `OpaSecurityPolicy`. 
A shared security policy
+polls while at least one guarded route is running and stops polling when the 
last guarded route stops.
+Reload reads only the operator-configured resource; it does not read or 
download policy on each exchange.
+Publish resource updates atomically, such as by renaming a completed file over 
the configured file.
+
+For explicit reload, call `reloadPolicy()` on the started `OpaEndpoint` or 
`OpaSecurityPolicy`.
+It returns `true` after publishing changed content, `false` for unchanged 
content, and throws if loading
+or validation fails. The replacement is loaded, initialized with its 
configured entrypoint and data,
+and warmed before it becomes visible. Exchanges already using the previous 
snapshot finish with that
+snapshot, which closes after they drain. New exchanges use the replacement 
without waiting for those
+exchanges to finish. Stopping cancels the watcher and prevents an in-flight 
reload from publishing.
+
+`getPolicyReloadStatus()` exposes the active SHA-256 revision of the module 
and data, the time of the last
+successful check (the initial load, a published reload, or a poll that found 
the content unchanged), and the
+time and exception class name of the last failed reload, which stay visible 
after later successful checks.
+Failure diagnostics exclude exception messages and resource contents. A failed 
reload retains the last
+validated snapshot. Content that loads but fails validation or compilation is 
not built again by a poll until
+it changes, so one broken file logs one warning, while a resource that cannot 
be read at all is retried on every
+poll; an explicit `reloadPolicy()` always tries. Operators should monitor 
failures because
+retained policy can become stale. Reload and this option apply only to WASM 
evaluation; REST policy
+deployment remains managed by the OPA server.
+
 [[failure-handling]]
 == Failure handling
 
diff --git 
a/components/camel-opa/src/generated/java/org/apache/camel/component/opa/OpaComponentConfigurer.java
 
b/components/camel-opa/src/generated/java/org/apache/camel/component/opa/OpaComponentConfigurer.java
index ac3864b907be..681dc5022ebe 100644
--- 
a/components/camel-opa/src/generated/java/org/apache/camel/component/opa/OpaComponentConfigurer.java
+++ 
b/components/camel-opa/src/generated/java/org/apache/camel/component/opa/OpaComponentConfigurer.java
@@ -68,6 +68,8 @@ public class OpaComponentConfigurer extends 
PropertyConfigurerSupport implements
         case "opaClient": 
getOrCreateConfiguration(target).setOpaClient(property(camelContext, 
com.styra.opa.OPAClient.class, value)); return true;
         case "policybundle":
         case "policyBundle": 
getOrCreateConfiguration(target).setPolicyBundle(property(camelContext, 
java.lang.String.class, value)); return true;
+        case "policyreloadinterval":
+        case "policyReloadInterval": 
getOrCreateConfiguration(target).setPolicyReloadInterval(property(camelContext, 
java.time.Duration.class, value).toMillis()); return true;
         case "poolsize":
         case "poolSize": 
getOrCreateConfiguration(target).setPoolSize(property(camelContext, int.class, 
value)); return true;
         case "requesttimeout":
@@ -127,6 +129,8 @@ public class OpaComponentConfigurer extends 
PropertyConfigurerSupport implements
         case "opaClient": return com.styra.opa.OPAClient.class;
         case "policybundle":
         case "policyBundle": return java.lang.String.class;
+        case "policyreloadinterval":
+        case "policyReloadInterval": return long.class;
         case "poolsize":
         case "poolSize": return int.class;
         case "requesttimeout":
@@ -182,6 +186,8 @@ public class OpaComponentConfigurer extends 
PropertyConfigurerSupport implements
         case "opaClient": return 
getOrCreateConfiguration(target).getOpaClient();
         case "policybundle":
         case "policyBundle": return 
getOrCreateConfiguration(target).getPolicyBundle();
+        case "policyreloadinterval":
+        case "policyReloadInterval": return 
getOrCreateConfiguration(target).getPolicyReloadInterval();
         case "poolsize":
         case "poolSize": return getOrCreateConfiguration(target).getPoolSize();
         case "requesttimeout":
diff --git 
a/components/camel-opa/src/generated/java/org/apache/camel/component/opa/OpaEndpointConfigurer.java
 
b/components/camel-opa/src/generated/java/org/apache/camel/component/opa/OpaEndpointConfigurer.java
index c19a1c205979..1a99d958b1a8 100644
--- 
a/components/camel-opa/src/generated/java/org/apache/camel/component/opa/OpaEndpointConfigurer.java
+++ 
b/components/camel-opa/src/generated/java/org/apache/camel/component/opa/OpaEndpointConfigurer.java
@@ -54,6 +54,8 @@ public class OpaEndpointConfigurer extends 
PropertyConfigurerSupport implements
         case "opaClient": 
target.getConfiguration().setOpaClient(property(camelContext, 
com.styra.opa.OPAClient.class, value)); return true;
         case "policybundle":
         case "policyBundle": 
target.getConfiguration().setPolicyBundle(property(camelContext, 
java.lang.String.class, value)); return true;
+        case "policyreloadinterval":
+        case "policyReloadInterval": 
target.getConfiguration().setPolicyReloadInterval(property(camelContext, 
java.time.Duration.class, value).toMillis()); return true;
         case "poolsize":
         case "poolSize": 
target.getConfiguration().setPoolSize(property(camelContext, int.class, 
value)); return true;
         case "requesttimeout":
@@ -104,6 +106,8 @@ public class OpaEndpointConfigurer extends 
PropertyConfigurerSupport implements
         case "opaClient": return com.styra.opa.OPAClient.class;
         case "policybundle":
         case "policyBundle": return java.lang.String.class;
+        case "policyreloadinterval":
+        case "policyReloadInterval": return long.class;
         case "poolsize":
         case "poolSize": return int.class;
         case "requesttimeout":
@@ -150,6 +154,8 @@ public class OpaEndpointConfigurer extends 
PropertyConfigurerSupport implements
         case "opaClient": return target.getConfiguration().getOpaClient();
         case "policybundle":
         case "policyBundle": return 
target.getConfiguration().getPolicyBundle();
+        case "policyreloadinterval":
+        case "policyReloadInterval": return 
target.getConfiguration().getPolicyReloadInterval();
         case "poolsize":
         case "poolSize": return target.getConfiguration().getPoolSize();
         case "requesttimeout":
diff --git 
a/components/camel-opa/src/generated/java/org/apache/camel/component/opa/OpaEndpointUriFactory.java
 
b/components/camel-opa/src/generated/java/org/apache/camel/component/opa/OpaEndpointUriFactory.java
index bd704cb53c84..a903989dd907 100644
--- 
a/components/camel-opa/src/generated/java/org/apache/camel/component/opa/OpaEndpointUriFactory.java
+++ 
b/components/camel-opa/src/generated/java/org/apache/camel/component/opa/OpaEndpointUriFactory.java
@@ -24,7 +24,7 @@ public class OpaEndpointUriFactory extends 
org.apache.camel.support.component.En
     private static final Set<String> ENDPOINT_IDENTITY_PROPERTY_NAMES;
     private static final Map<String, String> MULTI_VALUE_PREFIXES;
     static {
-        Set<String> props = new HashSet<>(21);
+        Set<String> props = new HashSet<>(22);
         props.add("allowKey");
         props.add("batch");
         props.add("bearerToken");
@@ -42,6 +42,7 @@ public class OpaEndpointUriFactory extends 
org.apache.camel.support.component.En
         props.add("opaClient");
         props.add("policyBundle");
         props.add("policyPath");
+        props.add("policyReloadInterval");
         props.add("poolSize");
         props.add("requestTimeout");
         props.add("serverUrl");
diff --git 
a/components/camel-opa/src/generated/java/org/apache/camel/component/opa/security/OpaSecurityPolicyConfigurer.java
 
b/components/camel-opa/src/generated/java/org/apache/camel/component/opa/security/OpaSecurityPolicyConfigurer.java
index 9d3882a2c24e..d0a3a3885fcc 100644
--- 
a/components/camel-opa/src/generated/java/org/apache/camel/component/opa/security/OpaSecurityPolicyConfigurer.java
+++ 
b/components/camel-opa/src/generated/java/org/apache/camel/component/opa/security/OpaSecurityPolicyConfigurer.java
@@ -55,6 +55,8 @@ public class OpaSecurityPolicyConfigurer extends 
org.apache.camel.support.compon
         case "policyBundle": target.setPolicyBundle(property(camelContext, 
java.lang.String.class, value)); return true;
         case "policypath":
         case "policyPath": target.setPolicyPath(property(camelContext, 
java.lang.String.class, value)); return true;
+        case "policyreloadinterval":
+        case "policyReloadInterval": 
target.setPolicyReloadInterval(property(camelContext, long.class, value)); 
return true;
         case "poolsize":
         case "poolSize": target.setPoolSize(property(camelContext, int.class, 
value)); return true;
         case "requesttimeout":
@@ -103,6 +105,8 @@ public class OpaSecurityPolicyConfigurer extends 
org.apache.camel.support.compon
         case "policyBundle": return java.lang.String.class;
         case "policypath":
         case "policyPath": return java.lang.String.class;
+        case "policyreloadinterval":
+        case "policyReloadInterval": return long.class;
         case "poolsize":
         case "poolSize": return int.class;
         case "requesttimeout":
@@ -152,6 +156,8 @@ public class OpaSecurityPolicyConfigurer extends 
org.apache.camel.support.compon
         case "policyBundle": return target.getPolicyBundle();
         case "policypath":
         case "policyPath": return target.getPolicyPath();
+        case "policyreloadinterval":
+        case "policyReloadInterval": return target.getPolicyReloadInterval();
         case "poolsize":
         case "poolSize": return target.getPoolSize();
         case "requesttimeout":
diff --git 
a/components/camel-opa/src/generated/resources/META-INF/org/apache/camel/component/opa/opa.json
 
b/components/camel-opa/src/generated/resources/META-INF/org/apache/camel/component/opa/opa.json
index 5d41c69a2137..e1c4a23faf51 100644
--- 
a/components/camel-opa/src/generated/resources/META-INF/org/apache/camel/component/opa/opa.json
+++ 
b/components/camel-opa/src/generated/resources/META-INF/org/apache/camel/component/opa/opa.json
@@ -41,14 +41,15 @@
     "healthCheckBundles": { "index": 14, "kind": "property", "displayName": 
"Health Check Bundles", "group": "advanced", "label": "advanced", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": "org.apache.camel.component.opa.OpaConfiguration", 
"configurationField": "configuration", "description": "Whether the server 
readiness check also requires activation of OPA's configured  [...]
     "inputExpression": { "index": 15, "kind": "property", "displayName": 
"Input Expression", "group": "advanced", "label": "advanced", "required": 
false, "type": "object", "javaType": "org.apache.camel.Expression", 
"deprecated": false, "autowired": false, "secret": false, 
"supportSimpleExpression": true, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "An expression producing the complete policy 
input as a Map [...]
     "opaClient": { "index": 16, "kind": "property", "displayName": "Opa 
Client", "group": "advanced", "label": "advanced", "required": false, "type": 
"object", "javaType": "com.styra.opa.OPAClient", "deprecated": false, 
"autowired": true, "secret": false, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "An existing OPAClient to use. When set, 
serverUrl and bearerToken are ignored." },
-    "poolSize": { "index": 17, "kind": "property", "displayName": "Pool Size", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 8, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How many WebAssembly policy instances to pool 
in wasm mode. An instance carries mutable state and is not thre [...]
-    "requestTimeout": { "index": 18, "kind": "property", "displayName": 
"Request Timeout", "group": "advanced", "label": "advanced", "required": false, 
"type": "duration", "javaType": "long", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "30000", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How long to wait for the decision once 
connected, in rest mode. A request that times out  [...]
-    "healthCheckConsumerEnabled": { "index": 19, "kind": "property", 
"displayName": "Health Check Consumer Enabled", "group": "health", "label": 
"health", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Used for enabling or disabling all consumer based health checks 
from this component" },
-    "healthCheckProducerEnabled": { "index": 20, "kind": "property", 
"displayName": "Health Check Producer Enabled", "group": "health", "label": 
"health", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Used for enabling or disabling all producer based health checks 
from this component. Notice: Camel has by default disabled all producer based 
health-checks. You can turn on produce [...]
-    "bearerToken": { "index": 21, "kind": "property", "displayName": "Bearer 
Token", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "Bearer token sent to the OPA server in the 
Authorization header, for an OPA instance that [...]
-    "failOpen": { "index": 22, "kind": "property", "displayName": "Fail Open", 
"group": "security", "label": "security", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "autowired": false, "secret": 
false, "security": "insecure:dev", "defaultValue": false, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "Whether to allow the exchange to proceed when 
the policy decision point i [...]
-    "sslContextParameters": { "index": 23, "kind": "property", "displayName": 
"Ssl Context Parameters", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "TLS configuration for the connection to the 
OPA server in [...]
-    "useGlobalSslContextParameters": { "index": 24, "kind": "property", 
"displayName": "Use Global Ssl Context Parameters", "group": "security", 
"label": "security", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Enable usage of global SSL context 
parameters." }
+    "policyReloadInterval": { "index": 17, "kind": "property", "displayName": 
"Policy Reload Interval", "group": "advanced", "label": "advanced", "required": 
false, "type": "duration", "javaType": "long", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": "0", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How often, in milliseconds, to check the 
configured WASM resource for changed po [...]
+    "poolSize": { "index": 18, "kind": "property", "displayName": "Pool Size", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 8, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How many WebAssembly policy instances to pool 
in wasm mode. An instance carries mutable state and is not thre [...]
+    "requestTimeout": { "index": 19, "kind": "property", "displayName": 
"Request Timeout", "group": "advanced", "label": "advanced", "required": false, 
"type": "duration", "javaType": "long", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "30000", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How long to wait for the decision once 
connected, in rest mode. A request that times out  [...]
+    "healthCheckConsumerEnabled": { "index": 20, "kind": "property", 
"displayName": "Health Check Consumer Enabled", "group": "health", "label": 
"health", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Used for enabling or disabling all consumer based health checks 
from this component" },
+    "healthCheckProducerEnabled": { "index": 21, "kind": "property", 
"displayName": "Health Check Producer Enabled", "group": "health", "label": 
"health", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Used for enabling or disabling all producer based health checks 
from this component. Notice: Camel has by default disabled all producer based 
health-checks. You can turn on produce [...]
+    "bearerToken": { "index": 22, "kind": "property", "displayName": "Bearer 
Token", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "Bearer token sent to the OPA server in the 
Authorization header, for an OPA instance that [...]
+    "failOpen": { "index": 23, "kind": "property", "displayName": "Fail Open", 
"group": "security", "label": "security", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "autowired": false, "secret": 
false, "security": "insecure:dev", "defaultValue": false, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "Whether to allow the exchange to proceed when 
the policy decision point i [...]
+    "sslContextParameters": { "index": 24, "kind": "property", "displayName": 
"Ssl Context Parameters", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "TLS configuration for the connection to the 
OPA server in [...]
+    "useGlobalSslContextParameters": { "index": 25, "kind": "property", 
"displayName": "Use Global Ssl Context Parameters", "group": "security", 
"label": "security", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Enable usage of global SSL context 
parameters." }
   },
   "headers": {
     "CamelOpaDecisionAllow": { "index": 0, "kind": "header", "displayName": 
"", "group": "producer", "label": "producer", "required": false, "javaType": 
"Boolean", "deprecated": false, "autowired": false, "secret": false, 
"description": "The allow\/deny verdict of the policy evaluation. Always 
overwritten by the component, so a value set by an inbound message never 
survives into the route.", "constantName": 
"org.apache.camel.component.opa.OpaConstants#DECISION_ALLOW" },
@@ -79,10 +80,11 @@
     "healthCheckBundles": { "index": 13, "kind": "parameter", "displayName": 
"Health Check Bundles", "group": "advanced", "label": "advanced", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": "org.apache.camel.component.opa.OpaConfiguration", 
"configurationField": "configuration", "description": "Whether the server 
readiness check also requires activation of OPA's configured [...]
     "inputExpression": { "index": 14, "kind": "parameter", "displayName": 
"Input Expression", "group": "advanced", "label": "advanced", "required": 
false, "type": "object", "javaType": "org.apache.camel.Expression", 
"deprecated": false, "autowired": false, "secret": false, 
"supportSimpleExpression": true, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "An expression producing the complete policy 
input as a Ma [...]
     "opaClient": { "index": 15, "kind": "parameter", "displayName": "Opa 
Client", "group": "advanced", "label": "advanced", "required": false, "type": 
"object", "javaType": "com.styra.opa.OPAClient", "deprecated": false, 
"autowired": true, "secret": false, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "An existing OPAClient to use. When set, 
serverUrl and bearerToken are ignored." },
-    "poolSize": { "index": 16, "kind": "parameter", "displayName": "Pool 
Size", "group": "advanced", "label": "advanced", "required": false, "type": 
"integer", "javaType": "int", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": 8, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How many WebAssembly policy instances to pool 
in wasm mode. An instance carries mutable state and is not thr [...]
-    "requestTimeout": { "index": 17, "kind": "parameter", "displayName": 
"Request Timeout", "group": "advanced", "label": "advanced", "required": false, 
"type": "duration", "javaType": "long", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "30000", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How long to wait for the decision once 
connected, in rest mode. A request that times out [...]
-    "bearerToken": { "index": 18, "kind": "parameter", "displayName": "Bearer 
Token", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "Bearer token sent to the OPA server in the 
Authorization header, for an OPA instance tha [...]
-    "failOpen": { "index": 19, "kind": "parameter", "displayName": "Fail 
Open", "group": "security", "label": "security", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "security": "insecure:dev", "defaultValue": false, 
"configurationClass": "org.apache.camel.component.opa.OpaConfiguration", 
"configurationField": "configuration", "description": "Whether to allow the 
exchange to proceed when the policy decision point  [...]
-    "sslContextParameters": { "index": 20, "kind": "parameter", "displayName": 
"Ssl Context Parameters", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "TLS configuration for the connection to the 
OPA server i [...]
+    "policyReloadInterval": { "index": 16, "kind": "parameter", "displayName": 
"Policy Reload Interval", "group": "advanced", "label": "advanced", "required": 
false, "type": "duration", "javaType": "long", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": "0", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How often, in milliseconds, to check the 
configured WASM resource for changed p [...]
+    "poolSize": { "index": 17, "kind": "parameter", "displayName": "Pool 
Size", "group": "advanced", "label": "advanced", "required": false, "type": 
"integer", "javaType": "int", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": 8, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How many WebAssembly policy instances to pool 
in wasm mode. An instance carries mutable state and is not thr [...]
+    "requestTimeout": { "index": 18, "kind": "parameter", "displayName": 
"Request Timeout", "group": "advanced", "label": "advanced", "required": false, 
"type": "duration", "javaType": "long", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "30000", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "How long to wait for the decision once 
connected, in rest mode. A request that times out [...]
+    "bearerToken": { "index": 19, "kind": "parameter", "displayName": "Bearer 
Token", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "Bearer token sent to the OPA server in the 
Authorization header, for an OPA instance tha [...]
+    "failOpen": { "index": 20, "kind": "parameter", "displayName": "Fail 
Open", "group": "security", "label": "security", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "security": "insecure:dev", "defaultValue": false, 
"configurationClass": "org.apache.camel.component.opa.OpaConfiguration", 
"configurationField": "configuration", "description": "Whether to allow the 
exchange to proceed when the policy decision point  [...]
+    "sslContextParameters": { "index": 21, "kind": "parameter", "displayName": 
"Ssl Context Parameters", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.opa.OpaConfiguration", "configurationField": 
"configuration", "description": "TLS configuration for the connection to the 
OPA server i [...]
   }
 }
diff --git 
a/components/camel-opa/src/generated/resources/META-INF/services/org/apache/camel/bean/OpaSecurityPolicy.json
 
b/components/camel-opa/src/generated/resources/META-INF/services/org/apache/camel/bean/OpaSecurityPolicy.json
index e63c588ce2ee..9e118e8397f5 100644
--- 
a/components/camel-opa/src/generated/resources/META-INF/services/org/apache/camel/bean/OpaSecurityPolicy.json
+++ 
b/components/camel-opa/src/generated/resources/META-INF/services/org/apache/camel/bean/OpaSecurityPolicy.json
@@ -10,7 +10,7 @@
     "groupId": "org.apache.camel",
     "artifactId": "camel-opa",
     "version": "4.24.0-SNAPSHOT",
-    "properties": { "serverUrl": { "index": 0, "kind": "property", 
"displayName": "Server Url", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "http:\/\/localhost:8181", "description": "The base URL of the 
OPA server, without the \/v1\/data suffix. Not used in wasm mode." }, 
"policyPath": { "index": 1, "kind": "property", "displayName": "Policy Path", 
"required": true, "type": "string", "javaT [...]
+    "properties": { "serverUrl": { "index": 0, "kind": "property", 
"displayName": "Server Url", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "http:\/\/localhost:8181", "description": "The base URL of the 
OPA server, without the \/v1\/data suffix. Not used in wasm mode." }, 
"policyPath": { "index": 1, "kind": "property", "displayName": "Policy Path", 
"required": true, "type": "string", "javaT [...]
   }
 }
 
diff --git a/components/camel-opa/src/main/docs/opa-component.adoc 
b/components/camel-opa/src/main/docs/opa-component.adoc
index 5a6920987e40..5d37f259b00d 100644
--- a/components/camel-opa/src/main/docs/opa-component.adoc
+++ b/components/camel-opa/src/main/docs/opa-component.adoc
@@ -682,6 +682,39 @@ shared concurrently. An evaluation failure discards the 
instance, and its replac
 entrypoint and data before use. Large static data therefore adds 
initialization work per instance, rather than
 being parsed again for every exchange.
 
+=== Reloading a WASM policy
+
+A WASM endpoint or security policy keeps the policy module and its bundled 
data together as one immutable
+snapshot. By default it loads the configured resource at startup only. Set 
`policyReloadInterval` to a
+positive duration in milliseconds to poll that resource using a Camel-managed 
scheduler, for example:
+
+[source,java]
+----
+.to("opa:authz/allow?evaluationMode=wasm&policyBundle=file:/etc/policies/bundle.tar.gz&policyReloadInterval=5000")
+----
+
+The same `policyReloadInterval` property is available on `OpaSecurityPolicy`. 
A shared security policy
+polls while at least one guarded route is running and stops polling when the 
last guarded route stops.
+Reload reads only the operator-configured resource; it does not read or 
download policy on each exchange.
+Publish resource updates atomically, such as by renaming a completed file over 
the configured file.
+
+For explicit reload, call `reloadPolicy()` on the started `OpaEndpoint` or 
`OpaSecurityPolicy`.
+It returns `true` after publishing changed content, `false` for unchanged 
content, and throws if loading
+or validation fails. The replacement is loaded, initialized with its 
configured entrypoint and data,
+and warmed before it becomes visible. Exchanges already using the previous 
snapshot finish with that
+snapshot, which closes after they drain. New exchanges use the replacement 
without waiting for those
+exchanges to finish. Stopping cancels the watcher and prevents an in-flight 
reload from publishing.
+
+`getPolicyReloadStatus()` exposes the active SHA-256 revision of the module 
and data, the time of the last
+successful check (the initial load, a published reload, or a poll that found 
the content unchanged), and the
+time and exception class name of the last failed reload, which stay visible 
after later successful checks.
+Failure diagnostics exclude exception messages and resource contents. A failed 
reload retains the last
+validated snapshot. Content that loads but fails validation or compilation is 
not built again by a poll until
+it changes, so one broken file logs one warning, while a resource that cannot 
be read at all is retried on every
+poll; an explicit `reloadPolicy()` always tries. Operators should monitor 
failures because
+retained policy can become stale. Reload and this option apply only to WASM 
evaluation; REST policy
+deployment remains managed by the OPA server.
+
 [[failure-handling]]
 == Failure handling
 
diff --git 
a/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaConfiguration.java
 
b/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaConfiguration.java
index 1c789eb42780..e5e8ae87a853 100644
--- 
a/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaConfiguration.java
+++ 
b/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaConfiguration.java
@@ -67,6 +67,8 @@ public class OpaConfiguration implements Cloneable {
     private int poolSize = 8;
     @UriParam(label = "advanced", defaultValue = "30000", javaType = 
"java.time.Duration")
     private long borrowTimeout = 30000;
+    @UriParam(label = "advanced", defaultValue = "0", javaType = 
"java.time.Duration")
+    private long policyReloadInterval;
 
     @UriParam(label = "advanced", defaultValue = "10000", javaType = 
"java.time.Duration")
     private long connectionTimeout = 10000;
@@ -245,6 +247,19 @@ public class OpaConfiguration implements Cloneable {
         this.poolSize = poolSize;
     }
 
+    public long getPolicyReloadInterval() {
+        return policyReloadInterval;
+    }
+
+    /**
+     * How often, in milliseconds, to check the configured WASM resource for 
changed policy or data. Zero disables
+     * automatic reload. Replacements are validated before publication; failed 
reloads retain the active revision. This
+     * option applies only to wasm mode.
+     */
+    public void setPolicyReloadInterval(long policyReloadInterval) {
+        this.policyReloadInterval = policyReloadInterval;
+    }
+
     public long getBorrowTimeout() {
         return borrowTimeout;
     }
diff --git 
a/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaEndpoint.java
 
b/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaEndpoint.java
index 05ac17ed0994..98b68d4787e4 100644
--- 
a/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaEndpoint.java
+++ 
b/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaEndpoint.java
@@ -171,11 +171,32 @@ public class OpaEndpoint extends DefaultEndpoint {
     }
 
     private OpaPolicyEvaluator createWasmEvaluator() throws Exception {
-        return OpaWasmEvaluator.create(
+        OpaReloadableWasmEvaluator replacement = 
OpaReloadableWasmEvaluator.create(
                 getCamelContext(), configuration.getPolicyBundle(), 
configuration.getEntrypoint(),
-                configuration.getPoolSize(), configuration.getBorrowTimeout(), 
policyPath, configuration.getAllowKey(),
+                configuration.getPoolSize(), configuration.getBorrowTimeout(), 
configuration.getPolicyReloadInterval(),
+                policyPath, configuration.getAllowKey(),
                 configuration.getIncludeHeaders(), 
configuration.getIncludeProperties(), configuration.isIncludeBody(),
                 configuration.isFailOpen(), 
configuration.getInputExpression());
+        try {
+            replacement.startWatching();
+            return replacement;
+        } catch (RuntimeException e) {
+            replacement.close();
+            throw e;
+        }
+    }
+
+    /** Explicitly reloads the configured WASM policy, retaining the active 
revision if validation fails. */
+    public boolean reloadPolicy() throws Exception {
+        if (evaluator instanceof OpaReloadableWasmEvaluator wasm) {
+            return wasm.reload();
+        }
+        throw new IllegalStateException("A started WASM endpoint is required 
to reload its policy");
+    }
+
+    /** The reload status of the WASM policy, or {@code null} when this 
endpoint does not evaluate in WASM mode. */
+    public OpaPolicyReloadStatus getPolicyReloadStatus() {
+        return evaluator instanceof OpaReloadableWasmEvaluator wasm ? 
wasm.getReloadStatus() : null;
     }
 
     @Override
diff --git 
a/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaPolicyReloadStatus.java
 
b/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaPolicyReloadStatus.java
new file mode 100644
index 000000000000..e871392a6b02
--- /dev/null
+++ 
b/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaPolicyReloadStatus.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.opa;
+
+import java.time.Instant;
+
+/**
+ * An immutable view of the active WebAssembly revision, the last successful 
check of the configured resource and the
+ * last failed reload. A later successful check does not clear the last 
failure, so it stays visible until another
+ * reload fails.
+ */
+public final class OpaPolicyReloadStatus {
+
+    private final String activeRevision;
+    private final Instant lastSuccessfulCheck;
+    private final Instant lastFailedReload;
+    private final String lastReloadFailureType;
+
+    OpaPolicyReloadStatus(String activeRevision, Instant lastSuccessfulCheck, 
Instant lastFailedReload,
+                          String lastReloadFailureType) {
+        this.activeRevision = activeRevision;
+        this.lastSuccessfulCheck = lastSuccessfulCheck;
+        this.lastFailedReload = lastFailedReload;
+        this.lastReloadFailureType = lastReloadFailureType;
+    }
+
+    /** The SHA-256 hex digest of the active WASM module and its data 
document. */
+    public String getActiveRevision() {
+        return activeRevision;
+    }
+
+    /**
+     * When the configured resource was last read and found valid: the initial 
load, a reload that published a new
+     * revision, or a poll that found the content unchanged. Never null.
+     */
+    public Instant getLastSuccessfulCheck() {
+        return lastSuccessfulCheck;
+    }
+
+    /** When a reload last failed, or {@code null} if none has failed. Kept 
after later successful checks. */
+    public Instant getLastFailedReload() {
+        return lastFailedReload;
+    }
+
+    /**
+     * The class name of the exception of the last failed reload, or {@code 
null} if none has failed. Only the class:
+     * messages and resource locations are not exposed through the status.
+     */
+    public String getLastReloadFailureType() {
+        return lastReloadFailureType;
+    }
+}
diff --git 
a/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaReloadableWasmEvaluator.java
 
b/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaReloadableWasmEvaluator.java
new file mode 100644
index 000000000000..e5bbfc6314d0
--- /dev/null
+++ 
b/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaReloadableWasmEvaluator.java
@@ -0,0 +1,344 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.opa;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.time.Instant;
+import java.util.HexFormat;
+import java.util.Map;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Expression;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Atomically replaces validated WASM policy/data snapshots while admitted 
evaluations drain the previous snapshot.
+ * Resource loading and policy construction never hold the decision-state lock.
+ */
+public final class OpaReloadableWasmEvaluator extends OpaPolicyEvaluator 
implements AutoCloseable {
+
+    private static final ObjectMapper MAPPER = new ObjectMapper();
+    private static final Logger LOG = 
LoggerFactory.getLogger(OpaReloadableWasmEvaluator.class);
+
+    @FunctionalInterface
+    interface BundleLoader {
+        OpaWasmEvaluator.Bundle load() throws Exception;
+    }
+
+    @FunctionalInterface
+    interface EvaluatorFactory {
+        OpaWasmEvaluator create(OpaWasmEvaluator.Bundle bundle) throws 
Exception;
+    }
+
+    private final Object state = new Object();
+    private final Object reloadLock = new Object();
+    private final CamelContext camelContext;
+    private final long reloadInterval;
+    private final BundleLoader loader;
+    private final EvaluatorFactory factory;
+    private Snapshot active;
+    private boolean closed;
+    private boolean reloadEnabled = true;
+    private long watchGeneration;
+    /** The revision of content that failed to load; a poll does not rebuild 
it until the content changes. */
+    private String lastFailedRevision;
+    private ScheduledExecutorService executor;
+    private ScheduledFuture<?> watch;
+    private volatile OpaPolicyReloadStatus status;
+
+    OpaReloadableWasmEvaluator(CamelContext camelContext, long reloadInterval, 
BundleLoader loader,
+                               EvaluatorFactory factory, String policyPath, 
String allowKey, String includeHeaders,
+                               String includeProperties, boolean includeBody, 
boolean failOpen) throws Exception {
+        this(camelContext, reloadInterval, loader, factory, policyPath, 
allowKey, includeHeaders, includeProperties,
+             includeBody, failOpen, null);
+    }
+
+    OpaReloadableWasmEvaluator(CamelContext camelContext, long reloadInterval, 
BundleLoader loader,
+                               EvaluatorFactory factory, String policyPath, 
String allowKey, String includeHeaders,
+                               String includeProperties, boolean includeBody, 
boolean failOpen,
+                               Expression inputExpression) throws Exception {
+        // the input is built here, by evaluate() of this outer evaluator, so 
the expression must reach this constructor
+        super(policyPath, allowKey, includeHeaders, includeProperties, 
includeBody, failOpen, inputExpression);
+        if (reloadInterval < 0) {
+            throw new IllegalArgumentException("policyReloadInterval must not 
be negative");
+        }
+        this.camelContext = ObjectHelper.notNull(camelContext, "camelContext");
+        this.reloadInterval = reloadInterval;
+        this.loader = loader;
+        this.factory = factory;
+        OpaWasmEvaluator.Bundle bundle = immutableBundle(loader.load());
+        String revision = revision(bundle);
+        // OpaWasmEvaluator warms its pool and applies the configured 
entrypoint/data before returning.
+        this.active = new Snapshot(factory.create(bundle), revision);
+        this.status = new OpaPolicyReloadStatus(revision, Instant.now(), null, 
null);
+    }
+
+    public static OpaReloadableWasmEvaluator create(
+            CamelContext camelContext, String policyBundle, String entrypoint, 
int poolSize, long borrowTimeout,
+            long reloadInterval, String policyPath, String allowKey, String 
includeHeaders, String includeProperties,
+            boolean includeBody, boolean failOpen, Expression inputExpression)
+            throws Exception {
+        OpaWasmEvaluator.validateWasmOptions(policyBundle, poolSize);
+        String resolvedEntrypoint = ObjectHelper.isNotEmpty(entrypoint) ? 
entrypoint : policyPath;
+        return new OpaReloadableWasmEvaluator(
+                camelContext, reloadInterval,
+                () -> OpaWasmEvaluator.loadPolicy(camelContext, policyBundle),
+                bundle -> new OpaWasmEvaluator(
+                        bundle.wasm(), bundle.data(), resolvedEntrypoint, 
poolSize, borrowTimeout,
+                        policyPath, allowKey, includeHeaders, 
includeProperties, includeBody, failOpen, inputExpression),
+                policyPath, allowKey, includeHeaders, includeProperties, 
includeBody, failOpen, inputExpression);
+    }
+
+    public OpaPolicyReloadStatus getReloadStatus() {
+        return status;
+    }
+
+    /** Re-reads the configured resource and publishes a validated replacement 
only when its content changed. */
+    public boolean reload() throws Exception {
+        long generation;
+        synchronized (state) {
+            ensureOpen(-1);
+            if (!reloadEnabled) {
+                throw new IllegalStateException("The WASM policy reload 
watcher is stopped");
+            }
+            generation = watchGeneration;
+        }
+        // an explicit reload tries again even when the same content failed 
before
+        return reload(generation, false);
+    }
+
+    private boolean reload(long generation, boolean skipKnownFailure) throws 
Exception {
+        synchronized (reloadLock) {
+            synchronized (state) {
+                ensureOpen(generation);
+            }
+            OpaWasmEvaluator replacement = null;
+            boolean published = false;
+            String revision = null;
+            try {
+                OpaWasmEvaluator.Bundle loaded = loader.load();
+                // computed before the validation, so content that loads but 
does not validate is remembered too
+                revision = revision(loaded);
+                OpaWasmEvaluator.Bundle bundle = immutableBundle(loaded);
+                synchronized (state) {
+                    ensureOpen(generation);
+                    if (active.revision.equals(revision)) {
+                        // a successful check; the last failure stays visible 
in the status
+                        status = new OpaPolicyReloadStatus(
+                                revision, Instant.now(), 
status.getLastFailedReload(), status.getLastReloadFailureType());
+                        return false;
+                    }
+                    if (skipKnownFailure && 
revision.equals(lastFailedRevision)) {
+                        // the content that failed to load is still there: 
building it again would fail the same way
+                        // and log the same warning on every poll, so wait for 
it to change
+                        LOG.debug("WASM policy {} still has the content that 
failed to load; waiting for it to change",
+                                getPolicyPath());
+                        return false;
+                    }
+                }
+                replacement = factory.create(bundle);
+                Snapshot previous;
+                synchronized (state) {
+                    ensureOpen(generation);
+                    previous = active;
+                    active = new Snapshot(replacement, revision);
+                    published = true;
+                    previous.retired = true;
+                    lastFailedRevision = null;
+                    status = new OpaPolicyReloadStatus(
+                            revision, Instant.now(), 
status.getLastFailedReload(), status.getLastReloadFailureType());
+                    if (previous.readers != 0) {
+                        previous = null;
+                    }
+                }
+                if (previous != null) {
+                    previous.evaluator.close();
+                }
+                return true;
+            } catch (Throwable e) {
+                // an Error from the module compiler (a LinkageError, say) is 
a failed load like any other: remembered,
+                // shown in the status and rethrown as it is; the previous 
snapshot keeps deciding either way
+                synchronized (state) {
+                    if (!closed && (generation < 0 || generation == 
watchGeneration)) {
+                        lastFailedRevision = revision;
+                        status = new OpaPolicyReloadStatus(
+                                active.revision, 
status.getLastSuccessfulCheck(),
+                                Instant.now(), e.getClass().getName());
+                    }
+                }
+                throw e;
+            } finally {
+                if (replacement != null && !published) {
+                    replacement.close();
+                }
+            }
+        }
+    }
+
+    /**
+     * Enables reloading and, when {@code policyReloadInterval} is positive, 
starts the Camel-managed scheduler that
+     * polls the configured resource. Safe to call after {@link 
#stopWatching()} to enable reloads again.
+     */
+    public void startWatching() {
+        synchronized (state) {
+            ensureOpen(-1);
+            reloadEnabled = true;
+            if (reloadInterval == 0 || watch != null) {
+                return;
+            }
+            long generation = ++watchGeneration;
+            executor = 
camelContext.getExecutorServiceManager().newSingleThreadScheduledExecutor(this, 
"opa-policy-reload");
+            try {
+                watch = executor.scheduleWithFixedDelay(() -> 
poll(generation), reloadInterval, reloadInterval,
+                        TimeUnit.MILLISECONDS);
+            } catch (RuntimeException e) {
+                camelContext.getExecutorServiceManager().shutdownNow(executor);
+                executor = null;
+                throw e;
+            }
+        }
+    }
+
+    /**
+     * Disables reloading and cancels the scheduler. After this call {@link 
#reload()} throws
+     * {@link IllegalStateException}, also when no interval was configured, 
until {@link #startWatching()} is called
+     * again.
+     */
+    public void stopWatching() {
+        ScheduledExecutorService stopped;
+        synchronized (state) {
+            reloadEnabled = false;
+            ++watchGeneration;
+            if (watch != null) {
+                watch.cancel(true);
+                watch = null;
+            }
+            stopped = executor;
+            executor = null;
+        }
+        if (stopped != null) {
+            camelContext.getExecutorServiceManager().shutdownNow(stopped);
+        }
+    }
+
+    private void poll(long generation) {
+        try {
+            reload(generation, true);
+        } catch (Throwable e) {
+            // also an Error: a run that lets it escape would cancel every 
later run of the scheduler, and the watcher
+            // would stop for good without a status change or a log line
+            synchronized (state) {
+                if (!closed && generation == watchGeneration) {
+                    LOG.warn("Could not reload WASM policy {}; retaining 
revision {}. Failure type: {}",
+                            getPolicyPath(), active.revision, 
e.getClass().getName());
+                }
+            }
+        }
+    }
+
+    private void ensureOpen(long generation) {
+        if (closed || generation >= 0 && (!reloadEnabled || generation != 
watchGeneration)) {
+            throw new IllegalStateException("The WASM policy evaluator or its 
reload watcher is stopped");
+        }
+    }
+
+    @Override
+    protected Object evaluateDecision(Map<String, Object> input) throws 
Exception {
+        Snapshot snapshot;
+        synchronized (state) {
+            ensureOpen(-1);
+            snapshot = active;
+            snapshot.readers++;
+        }
+        try {
+            return snapshot.evaluator.evaluateDecision(input);
+        } finally {
+            boolean drained;
+            synchronized (state) {
+                drained = --snapshot.readers == 0 && snapshot.retired;
+            }
+            if (drained) {
+                snapshot.evaluator.close();
+            }
+        }
+    }
+
+    @Override
+    protected boolean isDecisionPointUnavailable(Exception failure) {
+        return failure instanceof TimeoutException;
+    }
+
+    @Override
+    public void close() {
+        Snapshot drained;
+        synchronized (state) {
+            if (closed) {
+                return;
+            }
+            closed = true;
+            active.retired = true;
+            drained = active.readers == 0 ? active : null;
+        }
+        stopWatching();
+        if (drained != null) {
+            drained.evaluator.close();
+        }
+    }
+
+    private static OpaWasmEvaluator.Bundle 
immutableBundle(OpaWasmEvaluator.Bundle bundle) throws Exception {
+        if (bundle.data() != null) {
+            JsonNode data = 
MAPPER.reader().with(DeserializationFeature.FAIL_ON_TRAILING_TOKENS).readTree(bundle.data());
+            if (data == null || data.isMissingNode()) {
+                throw new IllegalArgumentException("WASM bundle data must be a 
JSON document");
+            }
+        }
+        return new OpaWasmEvaluator.Bundle(bundle.wasm().clone(), 
bundle.data());
+    }
+
+    private static String revision(OpaWasmEvaluator.Bundle bundle) throws 
Exception {
+        MessageDigest digest = MessageDigest.getInstance("SHA-256");
+        byte[] data = bundle.data() != null ? 
bundle.data().getBytes(StandardCharsets.UTF_8) : new byte[0];
+        
digest.update(ByteBuffer.allocate(Integer.BYTES).putInt(bundle.wasm().length).array());
+        digest.update(bundle.wasm());
+        digest.update(ByteBuffer.allocate(Integer.BYTES).putInt(bundle.data() 
== null ? -1 : data.length).array());
+        digest.update(data);
+        return HexFormat.of().formatHex(digest.digest());
+    }
+
+    private static final class Snapshot {
+        private final OpaWasmEvaluator evaluator;
+        private final String revision;
+        private int readers;
+        private boolean retired;
+
+        private Snapshot(OpaWasmEvaluator evaluator, String revision) {
+            this.evaluator = ObjectHelper.notNull(evaluator, "evaluator");
+            this.revision = revision;
+        }
+    }
+}
diff --git 
a/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaWasmEvaluator.java
 
b/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaWasmEvaluator.java
index b411f3a668b5..f0ed1f5b377b 100644
--- 
a/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaWasmEvaluator.java
+++ 
b/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaWasmEvaluator.java
@@ -111,8 +111,24 @@ public class OpaWasmEvaluator extends OpaPolicyEvaluator 
implements AutoCloseabl
     }
 
     /**
-     * Builds a wasm evaluator from a bundle location, applying the validation 
and the entrypoint default in one place
-     * so that the producer and the {@code OpaSecurityPolicy} construct it 
identically.
+     * The checks every WASM evaluator makes on its options, shared with 
{@link OpaReloadableWasmEvaluator#create} so
+     * the producer, the policy and the reloading wrapper refuse the same 
configurations with the same hint.
+     */
+    static void validateWasmOptions(String policyBundle, int poolSize) {
+        if (ObjectHelper.isEmpty(policyBundle)) {
+            throw new IllegalArgumentException(
+                    "policyBundle is required when evaluationMode=wasm; build 
one with"
+                                               + " opa build -t wasm -e 
<entrypoint> <policy.rego>");
+        }
+        if (poolSize < 1) {
+            throw new IllegalArgumentException("poolSize must be at least 1 
when evaluationMode=wasm, was " + poolSize);
+        }
+    }
+
+    /**
+     * Builds a non-reloading wasm evaluator from a bundle location, applying 
the validation and the entrypoint default
+     * in one place. The producer and the {@code OpaSecurityPolicy} build 
through
+     * {@link OpaReloadableWasmEvaluator#create}, which wraps evaluators built 
like this one.
      */
     public static OpaWasmEvaluator create(
             CamelContext camelContext, String policyBundle, String entrypoint, 
int poolSize, long borrowTimeout,
@@ -128,14 +144,7 @@ public class OpaWasmEvaluator extends OpaPolicyEvaluator 
implements AutoCloseabl
             String policyPath, String allowKey, String includeHeaders, String 
includeProperties, boolean includeBody,
             boolean failOpen, Expression inputExpression)
             throws Exception {
-        if (ObjectHelper.isEmpty(policyBundle)) {
-            throw new IllegalArgumentException(
-                    "policyBundle is required when evaluationMode=wasm; build 
one with"
-                                               + " opa build -t wasm -e 
<entrypoint> <policy.rego>");
-        }
-        if (poolSize < 1) {
-            throw new IllegalArgumentException("poolSize must be at least 1 
when evaluationMode=wasm, was " + poolSize);
-        }
+        validateWasmOptions(policyBundle, poolSize);
         // the entrypoint is fixed at build time and is not the same thing as 
a data path, but opa build names it after
         // the rule, so the policy path is the right default
         String resolvedEntrypoint = ObjectHelper.isNotEmpty(entrypoint) ? 
entrypoint : policyPath;
diff --git 
a/components/camel-opa/src/main/java/org/apache/camel/component/opa/security/OpaSecurityPolicy.java
 
b/components/camel-opa/src/main/java/org/apache/camel/component/opa/security/OpaSecurityPolicy.java
index 330d8317b285..6312a71c9ffc 100644
--- 
a/components/camel-opa/src/main/java/org/apache/camel/component/opa/security/OpaSecurityPolicy.java
+++ 
b/components/camel-opa/src/main/java/org/apache/camel/component/opa/security/OpaSecurityPolicy.java
@@ -30,8 +30,9 @@ import org.apache.camel.Route;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.opa.OpaHttpClient;
 import org.apache.camel.component.opa.OpaPolicyEvaluator;
+import org.apache.camel.component.opa.OpaPolicyReloadStatus;
+import org.apache.camel.component.opa.OpaReloadableWasmEvaluator;
 import org.apache.camel.component.opa.OpaRestEvaluator;
-import org.apache.camel.component.opa.OpaWasmEvaluator;
 import org.apache.camel.health.HealthCheckRegistry;
 import org.apache.camel.spi.AuthorizationPolicy;
 import org.apache.camel.spi.Configurer;
@@ -133,6 +134,10 @@ public class OpaSecurityPolicy implements 
AuthorizationPolicy {
                             + " Running out of time is an evaluation failure 
rather than a deny: it fails closed, or"
                             + " proceeds when failOpen is set.")
     private long borrowTimeout = 30000;
+    @Metadata(label = "advanced", defaultValue = "0",
+              description = "How often, in milliseconds, to check the WASM 
resource for changed policy/data. Zero disables"
+                            + " automatic reload. Failed validation retains 
the active revision. Applies only to wasm mode.")
+    private long policyReloadInterval;
     @Metadata(label = "advanced",
               description = "An existing OPAClient to use instead of building 
one from serverUrl, bearerToken and"
                             + " sslContextParameters. No readiness check is 
registered for it.")
@@ -216,8 +221,9 @@ public class OpaSecurityPolicy implements 
AuthorizationPolicy {
         if (WASM_MODE.equalsIgnoreCase(evaluationMode)) {
             warnIgnoredServerOptions();
             try {
-                return OpaWasmEvaluator.create(camelContext, policyBundle, 
entrypoint, poolSize, borrowTimeout,
-                        policyPath, allowKey, includeHeaders, 
includeProperties, includeBody, failOpen, inputExpression);
+                return OpaReloadableWasmEvaluator.create(camelContext, 
policyBundle, entrypoint, poolSize, borrowTimeout,
+                        policyReloadInterval, policyPath, allowKey, 
includeHeaders, includeProperties, includeBody,
+                        failOpen, inputExpression);
             } catch (RuntimeException e) {
                 // the validation messages (policyBundle, poolSize) already 
read correctly; do not bury them
                 throw e;
@@ -302,6 +308,9 @@ public class OpaSecurityPolicy implements 
AuthorizationPolicy {
      * route is merely restarted.
      */
     synchronized void onProcessorStart() {
+        if (activeProcessors == 0 && evaluator instanceof 
OpaReloadableWasmEvaluator wasm) {
+            wasm.startWatching();
+        }
         activeProcessors++;
         registerHealthCheck();
     }
@@ -314,6 +323,9 @@ public class OpaSecurityPolicy implements 
AuthorizationPolicy {
     synchronized void onProcessorStop() {
         if (activeProcessors > 0 && --activeProcessors == 0) {
             unregisterHealthCheck();
+            if (evaluator instanceof OpaReloadableWasmEvaluator wasm) {
+                wasm.stopWatching();
+            }
         }
     }
 
@@ -487,6 +499,31 @@ public class OpaSecurityPolicy implements 
AuthorizationPolicy {
         this.poolSize = poolSize;
     }
 
+    public long getPolicyReloadInterval() {
+        return policyReloadInterval;
+    }
+
+    public void setPolicyReloadInterval(long policyReloadInterval) {
+        this.policyReloadInterval = policyReloadInterval;
+    }
+
+    /** Explicitly reloads the configured WASM policy, retaining the active 
revision if validation fails. */
+    public boolean reloadPolicy() throws Exception {
+        OpaReloadableWasmEvaluator wasm;
+        synchronized (this) {
+            if (activeProcessors == 0 || !(evaluator instanceof 
OpaReloadableWasmEvaluator)) {
+                throw new IllegalStateException("A started WASM policy is 
required to reload its policy");
+            }
+            wasm = (OpaReloadableWasmEvaluator) evaluator;
+        }
+        return wasm.reload();
+    }
+
+    /** The reload status of the WASM policy, or {@code null} when this policy 
does not evaluate in WASM mode. */
+    public OpaPolicyReloadStatus getPolicyReloadStatus() {
+        return evaluator instanceof OpaReloadableWasmEvaluator wasm ? 
wasm.getReloadStatus() : null;
+    }
+
     public long getBorrowTimeout() {
         return borrowTimeout;
     }
diff --git 
a/components/camel-opa/src/test/java/org/apache/camel/component/opa/OpaReloadableWasmEvaluatorTest.java
 
b/components/camel-opa/src/test/java/org/apache/camel/component/opa/OpaReloadableWasmEvaluatorTest.java
new file mode 100644
index 000000000000..e2441694d0d3
--- /dev/null
+++ 
b/components/camel-opa/src/test/java/org/apache/camel/component/opa/OpaReloadableWasmEvaluatorTest.java
@@ -0,0 +1,411 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.opa;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.camel.impl.DefaultCamelContext;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.awaitility.Awaitility.await;
+import static org.mockito.ArgumentMatchers.anyMap;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+@Timeout(10)
+class OpaReloadableWasmEvaluatorTest {
+
+    private static OpaWasmEvaluator.Bundle bundle(int version) {
+        return new OpaWasmEvaluator.Bundle(new byte[] { (byte) version }, 
"{\"version\":" + version + "}");
+    }
+
+    private OpaReloadableWasmEvaluator evaluator(
+            DefaultCamelContext context,
+            OpaReloadableWasmEvaluator.BundleLoader loader,
+            OpaReloadableWasmEvaluator.EvaluatorFactory factory)
+            throws Exception {
+        return new OpaReloadableWasmEvaluator(context, 0, loader, factory, 
"authz/allow", "allow", "*", "", false, false);
+    }
+
+    @Test
+    void publishesChangedContentAndSkipsUnchangedContent() throws Exception {
+        var content = new AtomicReference<>(bundle(1));
+        var old = mock(OpaWasmEvaluator.class);
+        var replacement = mock(OpaWasmEvaluator.class);
+        when(old.evaluateDecision(anyMap())).thenReturn(false);
+        when(replacement.evaluateDecision(anyMap())).thenReturn(true);
+        try (var context = new DefaultCamelContext();
+             var evaluator = evaluator(context, content::get, b -> b.wasm()[0] 
== 1 ? old : replacement)) {
+            String original = evaluator.getReloadStatus().getActiveRevision();
+            assertThat(evaluator.reload()).isFalse();
+            verify(old, never()).close();
+            content.set(bundle(2));
+            assertThat(evaluator.reload()).isTrue();
+            
assertThat(evaluator.getReloadStatus().getActiveRevision()).hasSize(64).isNotEqualTo(original);
+            assertThat(evaluator.evaluateDecision(Map.of())).isEqualTo(true);
+            verify(old).close();
+            assertThat(evaluator.reload()).isFalse();
+        }
+        verify(replacement).close();
+    }
+
+    @Test
+    void failedReplacementRetainsLastValidatedRevisionAndSafeDiagnostics() 
throws Exception {
+        var content = new AtomicReference<>(bundle(1));
+        var old = mock(OpaWasmEvaluator.class);
+        when(old.evaluateDecision(anyMap())).thenReturn(true);
+        try (var context = new DefaultCamelContext();
+             var evaluator = evaluator(context, content::get, b -> {
+                 if (b.wasm()[0] == 2) {
+                     throw new IOException("secret resource credentials");
+                 }
+                 return old;
+             })) {
+            String revision = evaluator.getReloadStatus().getActiveRevision();
+            content.set(bundle(2));
+            
assertThatThrownBy(evaluator::reload).isInstanceOf(IOException.class);
+            
assertThat(evaluator.getReloadStatus().getActiveRevision()).isEqualTo(revision);
+            
assertThat(evaluator.getReloadStatus().getLastReloadFailureType()).isEqualTo(IOException.class.getName());
+            
assertThat(evaluator.getReloadStatus().getLastFailedReload()).isNotNull();
+            assertThat(evaluator.evaluateDecision(Map.of())).isEqualTo(true);
+            verify(old, never()).close();
+            content.set(bundle(1));
+            var failedAt = evaluator.getReloadStatus().getLastFailedReload();
+            assertThat(evaluator.reload()).isFalse();
+            // a later successful check moves the check time and keeps the 
failure visible
+            
assertThat(evaluator.getReloadStatus().getLastSuccessfulCheck()).isAfterOrEqualTo(failedAt);
+            
assertThat(evaluator.getReloadStatus().getLastReloadFailureType()).isEqualTo(IOException.class.getName());
+            
assertThat(evaluator.getReloadStatus().getLastFailedReload()).isEqualTo(failedAt);
+        }
+    }
+
+    @Test
+    void oldEvaluationsDrainWithoutBlockingNewRevision() throws Exception {
+        var entered = new CountDownLatch(1);
+        var release = new CountDownLatch(1);
+        var content = new AtomicReference<>(bundle(1));
+        var old = mock(OpaWasmEvaluator.class);
+        var replacement = mock(OpaWasmEvaluator.class);
+        when(old.evaluateDecision(anyMap())).thenAnswer(call -> {
+            entered.countDown();
+            assertThat(release.await(5, TimeUnit.SECONDS)).isTrue();
+            return false;
+        });
+        when(replacement.evaluateDecision(anyMap())).thenReturn(true);
+        var executor = Executors.newSingleThreadExecutor();
+        try (var context = new DefaultCamelContext();
+             var evaluator = evaluator(context, content::get, b -> b.wasm()[0] 
== 1 ? old : replacement)) {
+            var decision = executor.submit(() -> 
evaluator.evaluateDecision(Map.of()));
+            assertThat(entered.await(5, TimeUnit.SECONDS)).isTrue();
+            content.set(bundle(2));
+            assertThat(evaluator.reload()).isTrue();
+            verify(old, never()).close();
+            assertThat(evaluator.evaluateDecision(Map.of())).isEqualTo(true);
+            release.countDown();
+            assertThat(decision.get(5, TimeUnit.SECONDS)).isEqualTo(false);
+            verify(old).close();
+        } finally {
+            release.countDown();
+            executor.shutdownNow();
+        }
+    }
+
+    @Test
+    void closeDuringWarmupRejectsAndClosesUnpublishedReplacement() throws 
Exception {
+        var warming = new CountDownLatch(1);
+        var release = new CountDownLatch(1);
+        var content = new AtomicReference<>(bundle(1));
+        var old = mock(OpaWasmEvaluator.class);
+        var replacement = mock(OpaWasmEvaluator.class);
+        var executor = Executors.newSingleThreadExecutor();
+        try (var context = new DefaultCamelContext()) {
+            var evaluator = evaluator(context, content::get, b -> {
+                if (b.wasm()[0] == 1) {
+                    return old;
+                }
+                warming.countDown();
+                assertThat(release.await(5, TimeUnit.SECONDS)).isTrue();
+                return replacement;
+            });
+            String revision = evaluator.getReloadStatus().getActiveRevision();
+            content.set(bundle(2));
+            var reload = executor.submit(() -> {
+                
assertThatThrownBy(evaluator::reload).isInstanceOf(IllegalStateException.class);
+            });
+            assertThat(warming.await(5, TimeUnit.SECONDS)).isTrue();
+            evaluator.close();
+            release.countDown();
+            reload.get(5, TimeUnit.SECONDS);
+            
assertThat(evaluator.getReloadStatus().getActiveRevision()).isEqualTo(revision);
+            verify(old).close();
+            verify(replacement).close();
+            evaluator.close();
+            verify(old, times(1)).close();
+            assertThatThrownBy(() -> 
evaluator.evaluateDecision(Map.of())).isInstanceOf(IllegalStateException.class);
+        } finally {
+            release.countDown();
+            executor.shutdownNow();
+        }
+    }
+
+    @Test
+    void stoppedWatcherCannotPublishAnInFlightReload() throws Exception {
+        var warming = new CountDownLatch(1);
+        var release = new CountDownLatch(1);
+        var content = new AtomicReference<>(bundle(1));
+        var old = mock(OpaWasmEvaluator.class);
+        var replacement = mock(OpaWasmEvaluator.class);
+        var executor = Executors.newSingleThreadExecutor();
+        try (var context = new DefaultCamelContext();
+             var evaluator = evaluator(context, content::get, b -> {
+                 if (b.wasm()[0] == 2) {
+                     warming.countDown();
+                     assertThat(release.await(5, TimeUnit.SECONDS)).isTrue();
+                     return replacement;
+                 }
+                 return old;
+             })) {
+            String revision = evaluator.getReloadStatus().getActiveRevision();
+            content.set(bundle(2));
+            var reload = executor.submit(() -> {
+                
assertThatThrownBy(evaluator::reload).isInstanceOf(IllegalStateException.class);
+            });
+            assertThat(warming.await(5, TimeUnit.SECONDS)).isTrue();
+            evaluator.stopWatching();
+            release.countDown();
+            reload.get(5, TimeUnit.SECONDS);
+            
assertThat(evaluator.getReloadStatus().getActiveRevision()).isEqualTo(revision);
+            verify(replacement).close();
+            verify(old, never()).close();
+        } finally {
+            release.countDown();
+            executor.shutdownNow();
+        }
+    }
+
+    @Test
+    void managedWatcherLoadsChangedResourceAndCanRestart() throws Exception {
+        var content = new AtomicReference<>(bundle(1));
+        var old = mock(OpaWasmEvaluator.class);
+        var replacement = mock(OpaWasmEvaluator.class);
+        try (var context = new DefaultCamelContext();
+             var evaluator = new OpaReloadableWasmEvaluator(
+                     context, 10, content::get,
+                     b -> b.wasm()[0] == 1 ? old : replacement,
+                     "authz/allow", "allow", "*", "", false, false)) {
+            String original = evaluator.getReloadStatus().getActiveRevision();
+            evaluator.startWatching();
+            content.set(bundle(2));
+            await().atMost(5, TimeUnit.SECONDS)
+                    .until(() -> 
!evaluator.getReloadStatus().getActiveRevision().equals(original));
+            evaluator.stopWatching();
+            verify(old).close();
+            evaluator.startWatching();
+            evaluator.stopWatching();
+        }
+        verify(replacement).close();
+    }
+
+    @Test
+    void managedWatcherDoesNotBuildTheSameFailedContentAgain() throws 
Exception {
+        var content = new AtomicReference<>(bundle(1));
+        var loads = new AtomicInteger();
+        var creations = new AtomicInteger();
+        var old = mock(OpaWasmEvaluator.class);
+        try (var context = new DefaultCamelContext();
+             var evaluator = new OpaReloadableWasmEvaluator(
+                     context, 10, () -> {
+                         loads.incrementAndGet();
+                         return content.get();
+                     },
+                     b -> {
+                         if (b.wasm()[0] == 2) {
+                             creations.incrementAndGet();
+                             throw new IOException("module rejected");
+                         }
+                         return old;
+                     },
+                     "authz/allow", "allow", "*", "", false, false)) {
+            String original = evaluator.getReloadStatus().getActiveRevision();
+            evaluator.startWatching();
+            content.set(bundle(2));
+            await().atMost(5, TimeUnit.SECONDS).until(() -> 
evaluator.getReloadStatus().getLastFailedReload() != null);
+            int loadsAtFailure = loads.get();
+            // the polls go on reading the resource, but the content that 
failed is not built again
+            await().atMost(5, TimeUnit.SECONDS).until(() -> loads.get() >= 
loadsAtFailure + 3);
+            assertThat(creations).hasValue(1);
+            
assertThat(evaluator.getReloadStatus().getActiveRevision()).isEqualTo(original);
+            // an explicit reload tries again
+            
assertThatThrownBy(evaluator::reload).isInstanceOf(IOException.class);
+            assertThat(creations).hasValue(2);
+            evaluator.stopWatching();
+        }
+    }
+
+    @Test
+    void anErrorFromTheFactoryIsRememberedLikeAnException() throws Exception {
+        var content = new AtomicReference<>(bundle(1));
+        var loads = new AtomicInteger();
+        var creations = new AtomicInteger();
+        var old = mock(OpaWasmEvaluator.class);
+        try (var context = new DefaultCamelContext();
+             var evaluator = new OpaReloadableWasmEvaluator(
+                     context, 10, () -> {
+                         loads.incrementAndGet();
+                         return content.get();
+                     },
+                     b -> {
+                         if (b.wasm()[0] == 2) {
+                             creations.incrementAndGet();
+                             throw new LinkageError("module compiler failure");
+                         }
+                         return old;
+                     },
+                     "authz/allow", "allow", "*", "", false, false)) {
+            String original = evaluator.getReloadStatus().getActiveRevision();
+            content.set(bundle(2));
+            
assertThatThrownBy(evaluator::reload).isInstanceOf(LinkageError.class);
+            
assertThat(evaluator.getReloadStatus().getActiveRevision()).isEqualTo(original);
+            
assertThat(evaluator.getReloadStatus().getLastReloadFailureType()).isEqualTo(LinkageError.class.getName());
+            
assertThat(evaluator.getReloadStatus().getLastFailedReload()).isNotNull();
+            // the polls do not build the same failing content again either
+            evaluator.startWatching();
+            int loadsBefore = loads.get();
+            await().atMost(5, TimeUnit.SECONDS).until(() -> loads.get() >= 
loadsBefore + 3);
+            assertThat(creations).hasValue(1);
+            evaluator.stopWatching();
+        }
+    }
+
+    @Test
+    void revisionIncludesDataAndDistinguishesMissingDataFromEmptyObject() 
throws Exception {
+        var content = new AtomicReference<>(new OpaWasmEvaluator.Bundle(new 
byte[] { 1 }, null));
+        var first = mock(OpaWasmEvaluator.class);
+        var second = mock(OpaWasmEvaluator.class);
+        try (var context = new DefaultCamelContext();
+             var evaluator = evaluator(context, content::get, b -> b.data() == 
null ? first : second)) {
+            String original = evaluator.getReloadStatus().getActiveRevision();
+            content.set(new OpaWasmEvaluator.Bundle(new byte[] { 1 }, "{}"));
+            assertThat(evaluator.reload()).isTrue();
+            
assertThat(evaluator.getReloadStatus().getActiveRevision()).isNotEqualTo(original);
+        }
+    }
+
+    @Test
+    void closeDrainsAdmittedDecisionWithoutClosingItsPoolEarly() throws 
Exception {
+        var entered = new CountDownLatch(1);
+        var release = new CountDownLatch(1);
+        var delegate = mock(OpaWasmEvaluator.class);
+        when(delegate.evaluateDecision(anyMap())).thenAnswer(call -> {
+            entered.countDown();
+            assertThat(release.await(5, TimeUnit.SECONDS)).isTrue();
+            return true;
+        });
+        var executor = Executors.newSingleThreadExecutor();
+        try (var context = new DefaultCamelContext()) {
+            var evaluator = evaluator(context, () -> bundle(1), b -> delegate);
+            var decision = executor.submit(() -> 
evaluator.evaluateDecision(Map.of()));
+            assertThat(entered.await(5, TimeUnit.SECONDS)).isTrue();
+            evaluator.close();
+            verify(delegate, never()).close();
+            
assertThatThrownBy(evaluator::reload).isInstanceOf(IllegalStateException.class);
+            release.countDown();
+            assertThat(decision.get(5, TimeUnit.SECONDS)).isEqualTo(true);
+            verify(delegate).close();
+        } finally {
+            release.countDown();
+            executor.shutdownNow();
+        }
+    }
+
+    @Test
+    void defaultDoesNotReloadResourceOnEachDecision() throws Exception {
+        var loads = new AtomicInteger();
+        var delegate = mock(OpaWasmEvaluator.class);
+        when(delegate.evaluateDecision(anyMap())).thenReturn(true);
+        try (var context = new DefaultCamelContext();
+             var evaluator = evaluator(context, () -> {
+                 loads.incrementAndGet();
+                 return bundle(1);
+             }, b -> delegate)) {
+            evaluator.startWatching();
+            evaluator.evaluateDecision(Map.of());
+            evaluator.evaluateDecision(Map.of());
+            assertThat(loads.get()).isEqualTo(1);
+        }
+    }
+
+    @Test
+    void malformedDataNeverReachesReplacementFactory() throws Exception {
+        var content = new AtomicReference<>(bundle(1));
+        var creations = new AtomicInteger();
+        var delegate = mock(OpaWasmEvaluator.class);
+        try (var context = new DefaultCamelContext();
+             var evaluator = evaluator(context, content::get, b -> {
+                 creations.incrementAndGet();
+                 return delegate;
+             })) {
+            String revision = evaluator.getReloadStatus().getActiveRevision();
+            content.set(new OpaWasmEvaluator.Bundle(new byte[] { 1 }, 
"{invalid"));
+            
assertThatThrownBy(evaluator::reload).isInstanceOf(Exception.class);
+            content.set(new OpaWasmEvaluator.Bundle(new byte[] { 1 }, "{} 
{}"));
+            
assertThatThrownBy(evaluator::reload).isInstanceOf(Exception.class);
+            content.set(new OpaWasmEvaluator.Bundle(new byte[] { 1 }, " "));
+            
assertThatThrownBy(evaluator::reload).isInstanceOf(IllegalArgumentException.class);
+            assertThat(creations.get()).isEqualTo(1);
+            
assertThat(evaluator.getReloadStatus().getActiveRevision()).isEqualTo(revision);
+        }
+    }
+
+    @Test
+    void rapidReloadsCloseEachRetiredSnapshotOnce() throws Exception {
+        var content = new AtomicReference<>(bundle(1));
+        var delegates = new ArrayList<OpaWasmEvaluator>();
+        try (var context = new DefaultCamelContext();
+             var evaluator = evaluator(context, content::get, b -> {
+                 var delegate = mock(OpaWasmEvaluator.class);
+                 when(delegate.evaluateDecision(anyMap())).thenReturn((int) 
b.wasm()[0]);
+                 delegates.add(delegate);
+                 return delegate;
+             })) {
+            for (int version = 2; version <= 10; version++) {
+                content.set(bundle(version));
+                assertThat(evaluator.reload()).isTrue();
+                
assertThat(evaluator.evaluateDecision(Map.of())).isEqualTo(version);
+                verify(delegates.get(version - 2)).close();
+                verify(delegates.get(version - 1), never()).close();
+            }
+        }
+        for (var delegate : delegates) {
+            verify(delegate, times(1)).close();
+        }
+    }
+
+}
diff --git 
a/components/camel-opa/src/test/java/org/apache/camel/component/opa/OpaWasmIT.java
 
b/components/camel-opa/src/test/java/org/apache/camel/component/opa/OpaWasmIT.java
index 34626c7fbe27..6987b0b717a2 100644
--- 
a/components/camel-opa/src/test/java/org/apache/camel/component/opa/OpaWasmIT.java
+++ 
b/components/camel-opa/src/test/java/org/apache/camel/component/opa/OpaWasmIT.java
@@ -21,16 +21,21 @@ import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
+import org.apache.camel.CamelAuthorizationException;
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.opa.security.OpaSecurityPolicy;
 import org.apache.camel.health.HealthCheck;
 import org.apache.camel.health.HealthCheckHelper;
 import org.apache.camel.health.WritableHealthCheckRepository;
@@ -47,6 +52,8 @@ import org.junit.jupiter.api.io.TempDir;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.awaitility.Awaitility.await;
 
 /**
  * In-process evaluation of a bundle compiled from the very {@code authz.rego} 
that {@link OpaIT} uploads to a real OPA
@@ -284,6 +291,95 @@ public class OpaWasmIT extends CamelTestSupport {
         }
     }
 
+    @Test
+    void 
atomicallyReloadsGeneratedWasmWithChangedDataAndRetainsItAfterInvalidReplacement()
 throws Exception {
+        var original = OpaWasmEvaluator.loadPolicy(context, roles);
+        var content = new AtomicReference<>(original);
+        try (var evaluator = new OpaReloadableWasmEvaluator(
+                context, 0, content::get,
+                bundle -> new OpaWasmEvaluator(
+                        bundle.wasm(), bundle.data(), "roles/allow", 1, 1000,
+                        "roles/allow", "allow", "*", "", false, false),
+                "roles/allow", "allow", "*", "", false, false)) {
+            Map<String, Object> alice = Map.of("headers", Map.of("user", 
"alice"));
+            assertThat(evaluator.evaluateDecision(alice)).isEqualTo(false);
+            String originalRevision = 
evaluator.getReloadStatus().getActiveRevision();
+            content.set(new OpaWasmEvaluator.Bundle(original.wasm(), 
"{\"admins\":[\"alice\"]}"));
+            assertThat(evaluator.reload()).isTrue();
+            assertThat(evaluator.evaluateDecision(alice)).isEqualTo(true);
+            String activeRevision = 
evaluator.getReloadStatus().getActiveRevision();
+            assertThat(activeRevision).isNotEqualTo(originalRevision);
+            content.set(new OpaWasmEvaluator.Bundle(new byte[] { 0, 1, 2 }, 
"{}"));
+            
assertThatThrownBy(evaluator::reload).isInstanceOf(Exception.class);
+            
assertThat(evaluator.getReloadStatus().getActiveRevision()).isEqualTo(activeRevision);
+            assertThat(evaluator.evaluateDecision(alice)).isEqualTo(true);
+            // A valid module whose exported entrypoints do not include 
roles/allow is also rejected.
+            content.set(OpaWasmEvaluator.loadPolicy(context, authz));
+            
assertThatThrownBy(evaluator::reload).isInstanceOf(Exception.class);
+            
assertThat(evaluator.getReloadStatus().getActiveRevision()).isEqualTo(activeRevision);
+            assertThat(evaluator.evaluateDecision(alice)).isEqualTo(true);
+            content.set(new OpaWasmEvaluator.Bundle(original.wasm(), 
"{invalid"));
+            
assertThatThrownBy(evaluator::reload).isInstanceOf(Exception.class);
+            
assertThat(evaluator.getReloadStatus().getActiveRevision()).isEqualTo(activeRevision);
+        }
+    }
+
+    /**
+     * The wiring of {@code policyReloadInterval}: the endpoint starts the 
watcher in {@code createWasmEvaluator} and
+     * the security policy in {@code onProcessorStart}, so a bundle file 
renamed over the configured one is picked up by
+     * both without a restart.
+     */
+    @Test
+    @Timeout(60)
+    void reloadsThroughTheEndpointAndPolicyOptionsWhenTheBundleFileChanges() 
throws Exception {
+        byte[] promoted = OpaWasmBundleBuilder.build(
+                Map.of("roles.rego", 
resource("/wasm-data/roles.rego").getBytes(StandardCharsets.UTF_8),
+                        "data.json", 
"{\"admins\":[\"alice\"]}".getBytes(StandardCharsets.UTF_8)),
+                "roles/allow");
+        Path watched = bundles.resolve("reload-bundle.tar.gz");
+        Files.copy(Path.of(roles.substring("file:".length())), watched);
+        String bundle = "file:" + watched.toAbsolutePath();
+        String endpointUri = 
"opa:roles/allow?evaluationMode=wasm&policyBundle=" + bundle + 
"&policyReloadInterval=200";
+
+        OpaSecurityPolicy policy = new OpaSecurityPolicy();
+        policy.setEvaluationMode("wasm");
+        policy.setPolicyBundle(bundle);
+        policy.setPolicyPath("roles/allow");
+        policy.setPolicyReloadInterval(200);
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:reloadEndpoint").to(endpointUri);
+                
from("direct:reloadPolicy").policy(policy).to("mock:reloadGuarded");
+            }
+        });
+
+        Exchange denied = template.request("direct:reloadEndpoint", e -> 
e.getMessage().setHeader("user", "alice"));
+        
assertThat(denied.getMessage().getHeader(OpaConstants.DECISION_ALLOW)).isEqualTo(false);
+        Exchange refused = template.request("direct:reloadPolicy", e -> 
e.getMessage().setHeader("user", "alice"));
+        
assertThat(refused.getException()).isInstanceOf(CamelAuthorizationException.class);
+        OpaEndpoint endpoint = context.getEndpoint(endpointUri, 
OpaEndpoint.class);
+        String before = endpoint.getPolicyReloadStatus().getActiveRevision();
+        
assertThat(policy.getPolicyReloadStatus().getActiveRevision()).isEqualTo(before);
+
+        // published the way the docs recommend: a complete file renamed over 
the configured one
+        Path staged = bundles.resolve("reload-bundle.tar.gz.next");
+        Files.write(staged, promoted);
+        Files.move(staged, watched, StandardCopyOption.ATOMIC_MOVE, 
StandardCopyOption.REPLACE_EXISTING);
+
+        await().atMost(20, TimeUnit.SECONDS).untilAsserted(() -> {
+            Exchange allowed = template.request("direct:reloadEndpoint", e -> 
e.getMessage().setHeader("user", "alice"));
+            
assertThat(allowed.getMessage().getHeader(OpaConstants.DECISION_ALLOW)).isEqualTo(true);
+        });
+        
assertThat(endpoint.getPolicyReloadStatus().getActiveRevision()).isNotEqualTo(before);
+        await().atMost(20, TimeUnit.SECONDS).untilAsserted(() -> {
+            Exchange passed = template.request("direct:reloadPolicy", e -> 
e.getMessage().setHeader("user", "alice"));
+            assertThat(passed.getException()).isNull();
+        });
+        
assertThat(policy.getPolicyReloadStatus().getActiveRevision()).isNotEqualTo(before)
+                
.isEqualTo(endpoint.getPolicyReloadStatus().getActiveRevision());
+    }
+
     @Test
     @Timeout(60)
     void keepsThePoolUsableAfterRepeatedEvaluationFailures() {
diff --git 
a/components/camel-opa/src/test/java/org/apache/camel/component/opa/security/OpaSecurityPolicyWasmTest.java
 
b/components/camel-opa/src/test/java/org/apache/camel/component/opa/security/OpaSecurityPolicyWasmTest.java
index 43bcdb637cb9..2369dd3a0bf1 100644
--- 
a/components/camel-opa/src/test/java/org/apache/camel/component/opa/security/OpaSecurityPolicyWasmTest.java
+++ 
b/components/camel-opa/src/test/java/org/apache/camel/component/opa/security/OpaSecurityPolicyWasmTest.java
@@ -77,7 +77,8 @@ public class OpaSecurityPolicyWasmTest extends 
CamelTestSupport {
 
     @Test
     void failsRouteStartWhenNoWasmBundleIsConfigured() {
-        // buildEvaluator forwards to OpaWasmEvaluator.create, so its 
validation applies through the policy too
+        // buildEvaluator forwards to OpaReloadableWasmEvaluator.create, which 
validates through
+        // OpaWasmEvaluator.validateWasmOptions, so the same checks apply 
through the policy too
         OpaSecurityPolicy noBundle = new OpaSecurityPolicy();
         noBundle.setEvaluationMode("wasm");
         noBundle.setPolicyPath("authz/allow");
diff --git 
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/OpaComponentBuilderFactory.java
 
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/OpaComponentBuilderFactory.java
index 3d7e2a738466..ab4d9b0d6eed 100644
--- 
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/OpaComponentBuilderFactory.java
+++ 
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/OpaComponentBuilderFactory.java
@@ -414,6 +414,26 @@ public interface OpaComponentBuilderFactory {
         }
     
         
+        /**
+         * How often, in milliseconds, to check the configured WASM resource 
for
+         * changed policy or data. Zero disables automatic reload. Replacements
+         * are validated before publication; failed reloads retain the active
+         * revision. This option applies only to wasm mode.
+         * 
+         * The option is a: &lt;code&gt;long&lt;/code&gt; type.
+         * 
+         * Default: 0
+         * Group: advanced
+         * 
+         * @param policyReloadInterval the value to set
+         * @return the dsl builder
+         */
+        default OpaComponentBuilder policyReloadInterval(long 
policyReloadInterval) {
+            doSetProperty("policyReloadInterval", policyReloadInterval);
+            return this;
+        }
+    
+        
         /**
          * How many WebAssembly policy instances to pool in wasm mode. An
          * instance carries mutable state and is not thread-safe, so each
@@ -606,6 +626,7 @@ public interface OpaComponentBuilderFactory {
             case "healthCheckBundles": getOrCreateConfiguration((OpaComponent) 
component).setHealthCheckBundles((boolean) value); return true;
             case "inputExpression": getOrCreateConfiguration((OpaComponent) 
component).setInputExpression((org.apache.camel.Expression) value); return true;
             case "opaClient": getOrCreateConfiguration((OpaComponent) 
component).setOpaClient((com.styra.opa.OPAClient) value); return true;
+            case "policyReloadInterval": 
getOrCreateConfiguration((OpaComponent) 
component).setPolicyReloadInterval((long) value); return true;
             case "poolSize": getOrCreateConfiguration((OpaComponent) 
component).setPoolSize((int) value); return true;
             case "requestTimeout": getOrCreateConfiguration((OpaComponent) 
component).setRequestTimeout((long) value); return true;
             case "healthCheckConsumerEnabled": ((OpaComponent) 
component).setHealthCheckConsumerEnabled((boolean) value); return true;
diff --git 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpaEndpointBuilderFactory.java
 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpaEndpointBuilderFactory.java
index 7b99e67f891a..bb7447349ed5 100644
--- 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpaEndpointBuilderFactory.java
+++ 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpaEndpointBuilderFactory.java
@@ -611,6 +611,42 @@ public interface OpaEndpointBuilderFactory {
             doSetProperty("opaClient", opaClient);
             return this;
         }
+        /**
+         * How often, in milliseconds, to check the configured WASM resource 
for
+         * changed policy or data. Zero disables automatic reload. Replacements
+         * are validated before publication; failed reloads retain the active
+         * revision. This option applies only to wasm mode.
+         * 
+         * The option is a: <code>long</code> type.
+         * 
+         * Default: 0
+         * Group: advanced
+         * 
+         * @param policyReloadInterval the value to set
+         * @return the dsl builder
+         */
+        default AdvancedOpaEndpointBuilder policyReloadInterval(long 
policyReloadInterval) {
+            doSetProperty("policyReloadInterval", policyReloadInterval);
+            return this;
+        }
+        /**
+         * How often, in milliseconds, to check the configured WASM resource 
for
+         * changed policy or data. Zero disables automatic reload. Replacements
+         * are validated before publication; failed reloads retain the active
+         * revision. This option applies only to wasm mode.
+         * 
+         * The option will be converted to a <code>long</code> type.
+         * 
+         * Default: 0
+         * Group: advanced
+         * 
+         * @param policyReloadInterval the value to set
+         * @return the dsl builder
+         */
+        default AdvancedOpaEndpointBuilder policyReloadInterval(String 
policyReloadInterval) {
+            doSetProperty("policyReloadInterval", policyReloadInterval);
+            return this;
+        }
         /**
          * How many WebAssembly policy instances to pool in wasm mode. An
          * instance carries mutable state and is not thread-safe, so each

Reply via email to