Skip to content

CAMEL-27024: camel-spring-boot - the early resolution stops its properties function, which closes the vault client - #2113

Merged
Croway merged 1 commit into
apache:mainfrom
oscerd:feature/CAMEL-27024-early-resolution-close-clients
Nov 18, 2026
Merged

Croway merged 1 commit into
apache:mainfrom
oscerd:feature/CAMEL-27024-early-resolution-close-clients

Conversation

@oscerd

@oscerd oscerd commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Summary

CAMEL-27024: the early resolution of vault properties of Camel on Spring Boot (camel.component.<vault>.early-resolve-properties=true) creates a client in createPropertiesFunction, and nothing closed it once the properties were resolved. Each of these stayed open for the life of the application, although the early resolution uses it only at startup:

  • the AWS Secrets Manager parser's SecretsManagerClient, with its HTTP connection pool;
  • the Google Secret Manager parser's SecretManagerServiceClient, with its gRPC channel and threads;
  • the CyberArk parser's ConjurClient.

CAMEL-26919 (#2091) added a release(PropertiesFunction) hook to AbstractEarlyResolutionPropertiesParser. The base class calls it once the properties are resolved, also when they could not be, but so far only the HashiCorp Vault parser overrode it. Its default now stops the function when it is a Camel Service:

  • All the vault functions are services. Their doStop() closes their client:
    • AWS Secrets Manager, Google Secret Manager and CyberArk close the client;
    • HashiCorp Vault closes its client and revokes the token of its login;
    • Azure Key Vault (whose SecretClient cannot be closed), IBM Secrets Manager (the IBM SDK shares its HTTP client) and Spring Cloud Config (no client) have nothing to close, so stopping them is harmless.
  • Never started. A Camel service runs doStop() also when it was never started, as here.
  • AWS credentials. Closing the AWS client closes only what it owns. With camel.vault.aws.defaultCredentialsProvider, the SDK (2.57) builds its own DefaultCredentialsProvider instance, not the JVM-wide singleton of CAMEL-26367. The parser creates the static and profile providers itself.
  • HashiCorp Vault. The parser no longer overrides release, since the default does the same.
  • Failures and opt-out. A failure to release is still logged and ignored. A parser whose function is shared with something else can override release to do nothing.

The hook is new in 4.24.0, so changing its default affects no released version.

Tests

  • AbstractEarlyResolutionPropertiesParserTest: by default, a function that is a Camel service is stopped once the properties are resolved, and also when the resolution fails. A function that is not a service is resolved as before.
  • EarlyResolvedPropertiesAppRoleTest (Vault container) still checks that the token of the AppRole login is revoked once the properties are resolved, now through the default release.
  • Built core/camel-spring-boot and the seven vault starters against the published 4.24.0-SNAPSHOT. All 20 tests of AbstractEarlyResolutionPropertiesParserTest pass, and so do the tests of the starters: HashiCorp Vault 13, AWS Secrets Manager 2, Google Secret Manager 3, CyberArk 2, Azure Key Vault 2, IBM Secrets Manager 2 and Spring Cloud Config 3. The EarlyResolvedPropertiesTest of AWS, Google, CyberArk, Azure and IBM is skipped without cloud credentials, as on main.
  • With the previous no-op default, the two new tests fail, and EarlyResolvedPropertiesAppRoleTest fails on the revocation of the token.

Suggested by Croway in the review of #2091.

Claude Code on behalf of oscerd

🤖 Generated with Claude Code

…rties function, which closes the vault client

The early resolution of vault properties creates a client that nothing closed once the properties were
resolved: the SecretsManagerClient of AWS Secrets Manager, the SecretManagerServiceClient of Google Secret
Manager and the ConjurClient of CyberArk stayed open for the life of the application.

AbstractEarlyResolutionPropertiesParser.release, called once the properties are resolved (also when they
could not be), now stops the properties function by default when it is a Camel Service. The functions of the
Camel vaults close their client when they stop, also when they were never started. The HashiCorp Vault parser
no longer overrides release, since the default does the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
@oscerd
oscerd requested review from Croway and davsclaus November 18, 2026 13:31
@Croway
Croway merged commit 95cd00a into apache:main Nov 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants