Croway commented on PR #26845: URL: https://github.com/apache/camel/pull/26845#issuecomment-5816486081
Could you explain why `JdbcComponent` and `SqlComponent` each scan and evict every `DataSource` in the registry? Neither component owns those pools or knows which credentials changed. Multiple pools in one application are a supported configuration: if pool A's secret rotates, this callback also acts on pool B, and both components can act on the same pool. Camel already notifies registry beans implementing `SecretRotationAware`; would a callback registered by the `DataSource` owner be a better fit? It could obtain the new credential and perform the refresh appropriate to that pool. For example, DBCP2 documents that changing its password after pool initialization has no effect. Please also add a real rotation test using PostgreSQL with password authentication: 1. Create an application user with password A. Open two physical pooled connections, keeping one checked out and returning the other to idle. 2. Change the user's password to B through a separate admin connection. Verify that a new direct connection with A fails and one with B succeeds. 3. Update the secret source and trigger Camel's normal context reload. 4. Acquire a connection through a Camel route. Verify the query succeeds and `pg_backend_pid()` differs from both original connections. This demonstrates that the pool opened a new authenticated connection. 5. Verify the connection held during rotation can finish its work and is discarded after return. Run this scenario for each pool the PR claims to support. What behavior should the reload report if the new credentials cannot establish a connection? The current fallback only logs and continues. _AI-generated by Codex on behalf of @Croway._ -- 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]
