Skip to content

fix: cache expressions and sanitize errors in RoutingFunction and HeaderEnricher - #1567

Open
Divyanshkumar62 wants to merge 1 commit into
spring-cloud:mainfrom
Divyanshkumar62:fix/routing-header-expression-caching
Open

Divyanshkumar62 wants to merge 1 commit into
spring-cloud:mainfrom
Divyanshkumar62:fix/routing-header-expression-caching

Conversation

@Divyanshkumar62

Copy link
Copy Markdown

Fixes #1565

RoutingFunction and HeaderEnricher re-parsed SpEL expressions per message and exposed incoming message contents in routing errors or debug-level warnings.

Changes:

  • Cache parsed Expression instances in RoutingFunction using a bounded 256-entry LRU map shared by property and header expressions.
  • Log payload type and header names in RoutingFunction's unroutable IllegalStateException. Payload and header values are omitted.
  • Report the evaluated routingExpression instead of functionProperties.getRoutingExpression() when a header expression resolves to blank text or an unknown function.
  • Skip missing "0" entries in HeaderEnricher, cache its parsed expressions, and drop incoming message contents from debug warnings.
  • Add tests in RoutingFunctionTests and HeaderEnricherTests for caching, eviction, error reporting, missing "0" mappings, and sanitization.

…derEnricher

Signed-off-by: Divyansh Kumar <kumardivyansh62@gmail.com>

This branch has not been deployed

No deployments
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.

RoutingFunction and HeaderEnricher re-parse expressions per message and expose message content in errors

1 participant