davsclaus opened a new pull request, #30612: URL: https://github.com/apache/camel/pull/30612
Follow-up of CAMEL-27006, which added `org.apache.camel.spi.InMemoryStrategy` (`isInMemory()`) and implemented it for the stores that are always in memory. The `processor-detail` dev console and the JMX attributes of the idempotent consumer and the aggregator show the flag. The repositories of the configurable caches are in memory or not depending on their configuration. With this PR they answer for the configuration in use. True means that the data is kept only in memory, so it is lost when the application stops. False means it is kept elsewhere or the store cannot tell. A repository that is not started answers false. | Repository | True when | |---|---| | **camel-ehcache**: `EhcacheIdempotentRepository`, `EhcacheAggregationRepository`, `EhcacheKeyValueRepository` | every resource pool of the cache is heap, off-heap, or a disk tier that is not persistent. A persistent disk tier or a clustered tier keeps the data. | | **camel-infinispan-embedded**: `InfinispanEmbeddedIdempotentRepository`, `InfinispanEmbeddedAggregationRepository` | the cache has no store, or every store purges on startup. The cache is local (the default), or a replicated cache (or a distributed one with more than one owner) has no other node in the cluster. | | **camel-hazelcast**: `HazelcastIdempotentRepository`, `HazelcastAggregationRepository`, `ReplicatedHazelcastAggregationRepository`, `HazelcastKeyValueRepository` | Decided when asked, as the cluster changes. The instance must be a data member: false on a client or a lite member. It also needs no MapStore and no data persistence on the map. Then it is true when the member is alone in its cluster, or when the map has no backups (the default backup count of 1 keeps a copy on another member). A replicated map is true only when the member is alone. The aggregation repository also checks its recovery map. | | **camel-jcache**: `JCacheIdempotentRepository`, `JCacheAggregationRepository`, `JCacheKeyValueRepository` | the caching provider is the reference implementation or Caffeine, and the cache is not write-through. The JCache API cannot ask a cache whether it persists its entries, so the other providers (Hazelcast, Ehcache, Infinispan) answer false. | | **camel-spring**: `SpringCacheIdempotentRepository` | the cache is a `ConcurrentMapCache` (the Spring Boot default) or a `CaffeineCache`. Other caches, such as a `RedisCache`, answer false. | | **camel-seda**: `SedaEndpoint` | the queue is a JDK queue, which the queue factories of Camel create. A queue of another kind, given with the `queue` option, answers false. | The repositories of the other components keep their data outside the JVM (JDBC, JPA, Cassandra, MongoDB, Redis, Kafka, Infinispan remote), so they are unchanged. ### Tests Each test uses real caches, without mocks: - `EhcacheRepositoriesInMemoryTest`: heap only, heap and off-heap, a disk tier that is not persistent, and a persistent disk tier in a temporary directory. - `InfinispanEmbeddedRepositoriesInMemoryTest`: a local cache, a file store, a file store that purges on startup, a replicated cache with two embedded nodes, and a distributed cache with one owner. - `HazelcastRepositoriesInMemoryTest`: a member alone, a second member that joins (the answer changes), no backups with two members, a map with a MapStore, and a client. - `JCacheRepositoriesInMemoryTest`: the Hazelcast provider of the module's tests (false), and the provider and write-through rule. Neither the reference implementation nor Caffeine JCache is a test dependency. Adding one would make `Caching.getCachingProvider()` ambiguous for the existing tests. - `SpringCacheIdempotentRepositoryInMemoryTest`: `ConcurrentMapCacheManager` and `NoOpCacheManager`. - `SedaInMemoryTest` (camel-core): the default queue, and a queue of another kind. _Claude Code on behalf of Claus Ibsen_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
