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

   ### Description
   
   [CAMEL-25791](https://issues.apache.org/jira/browse/CAMEL-25791)
   
   Without an explicit `backend`, `StateStoreComponent` either shares a single 
registry `KeyValueRepository` across **all** store names or creates an 
in-memory one per store name. There is no way to get one dedicated backend per 
store name. Integrations can only plug in a backend by registering a global 
`KeyValueRepository` bean, which the Aggregate, Idempotent Consumer and Cache 
EIPs also auto-discover (for example an `optimisticLocking()` aggregator then 
fails to start).
   
   This came up while reviewing the Spring Cache adapter in 
apache/camel-spring-boot#2046 (CAMEL-24757), where `state-store:myStore` should 
map to the Spring cache `myStore`.
   
   ### Changes
   
   - New `StateStoreBackendFactory` functional interface: `KeyValueRepository 
createBackend(String storeName)`.
   - New autowired, advanced `backendFactory` component option. A runtime only 
needs to register a `StateStoreBackendFactory` bean, and the EIPs are not 
affected because it is not a `KeyValueRepository`.
   - Resolution order: explicit endpoint `backend` → `backendFactory` (once per 
store name, started and stopped by the component; `null` falls through) → 
single registry `KeyValueRepository` → `MemoryKeyValueRepository`.
   - Docs section "Backend per store name", plus regenerated configurer, 
component JSON, catalog and component DSL.
   
   The default behaviour is unchanged when no factory is set.
   
   ### Tests
   
   `StateStoreBackendFactoryTest` covers per-store isolation, precedence over a 
registry backend, `null` fallback to the registry, and an explicit endpoint 
backend taking precedence. All 23 tests in `camel-state-store` pass.
   
   _Claude Code on behalf of Croway (Federico Mariani)_


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