oscerd opened a new pull request, #29479:
URL: https://github.com/apache/camel/pull/29479

   ### Problem
   
   When a single `KeyValueRepository` instance is shared across patterns or 
components (such as the `state-store` component, `Cache` EIP, 
`KeyValueAggregationRepository`, or `KeyValueIdempotentRepository`), entries 
written by different components could collide in the underlying store. In 
particular, `StateStoreProducer` and `CacheProcessor` stored keys directly into 
the repository without namespacing, and calling `clear()` on a `state-store` 
endpoint removed all keys across all components sharing the repository. 
Additionally, `KeyValueAggregationRepository` assumed every value in the 
underlying store under its keys was a `DefaultExchangeHolder`.
   
   ### Change
   
   - Added `NamespacedKeyValueRepository` in `camel-support`, which provides a 
repository wrapper that partitions all keys under a designated namespace 
prefix, restricts `clear()` to delete only entries in that namespace, and 
returns un-prefixed keys in `keys()`.
   - Updated `StateStoreComponent` to partition each store backend under a 
dedicated namespace (`statestore:<storeName>:`).
   - Updated `CacheProcessor` to partition cached results under the `cache:` 
namespace.
   - Hardened `KeyValueAggregationRepository` to safely verify that entries are 
instances of `DefaultExchangeHolder` before unmarshalling or completing, 
logging a warning and returning null if an unexpected type is encountered.
   - Added an upgrade guide note in `camel-4x-upgrade-guide-4_24.adoc`.
   
   ### Tests
   
   - Added `NamespacedKeyValueRepositoryTest` in `camel-support` covering 
namespace prefixing, isolation, and scoped clearing.
   - Added `StateStoreNamespaceIsolationTest` in `camel-state-store` verifying 
multi-store isolation and scoped clearing across shared backends.
   - Added test coverage in `KeyValueAggregationRepositoryTest` verifying safe 
handling of unexpected entry types.
   - Updated existing tests in `camel-state-store` to assert namespaced backend 
keys.
   - All unit tests in `core/camel-support`, `core/camel-core-processor`, 
`core/camel-core`, and `components/camel-state-store` pass cleanly.
   
   _Antigravity on behalf of oscerd_
   


-- 
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]

Reply via email to