oscerd opened a new pull request, #26667: URL: https://github.com/apache/camel/pull/26667
This fixes [CAMEL-24751](https://issues.apache.org/jira/browse/CAMEL-24751) (raised by @davsclaus reviewing #26436 and deferred there as out of scope for that change). `OpaSecurityPolicy` registered a readiness check in `beforeWrap` but nothing removed it when the routes it guards stop or reload, so a route reload left the check behind in the `HealthCheckRegistry` reporting on a policy that was no longer enforcing anything. Registration is deduplicated by id, so this was *wrong* rather than a leak. `OpaSecurityProcessor` is a `Service`, so its start/stop now drive a ref-count on the policy: the check is registered on the first guarded route to start and unregistered once the last one stops. Registration moved out of `beforeWrap` into the processor lifecycle because `beforeWrap` does not run again when a route is merely restarted — a check unregistered on stop has to be restored on the next start. A policy shared by several routes keeps its check until all of them stop. The existing `OpaSecurityPolicyHealthCheckTest` still passes: the `ownsClient` guard and every registration decision are unchanged, only *when* registration runs moved. New `OpaSecurityPolicyHealthCheckLifecycleTest` covers the shared-route ref-count, the unregister-on-last-stop and the restore-on-restart, and fails against the previous code (verified by reverting the unregister). 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
