Claus Ibsen created CAMEL-27006:
-----------------------------------

             Summary: camel-core - InMemoryStrategy: a repository tells whether 
it keeps its data only in memory
                 Key: CAMEL-27006
                 URL: https://issues.apache.org/jira/browse/CAMEL-27006
             Project: Camel
          Issue Type: Improvement
          Components: camel-support, camel-caffeine, camel-core, 
camel-management
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 4.24.0


Some state stores keep their data only in the memory of the JVM, so the data is 
lost when the application stops. For example:
* the keys of an idempotent consumer with a MemoryIdempotentRepository
* the groups in progress of an aggregate with the default 
MemoryAggregationRepository
* the names of the files that a file consumer with noop=true has read (by 
default a MemoryIdempotentRepository of up to 1000 names)

After a restart the files are read again, duplicates pass again, and the groups 
in progress are gone.

Today nothing tells a user, or a tool, which stores are in memory:
* The processor-detail dev console shows the options that a route configures, 
not the defaults. So the default repository of a file consumer with noop=true 
does not show.
* JMX does not name the repository of an idempotent consumer or an aggregate.
* The class name does not say it either. The Caffeine repositories are in 
memory. The Ehcache, JCache, Spring cache and Infinispan repositories can be in 
memory or persistent, depending on how they are configured.

In the local-model benchmark (questions about a running app), the question "if 
I restart the app, will it charge the same orders again?" was answered wrong in 
5 of 6 answers. The model saw noop=true and said that the orders would not be 
charged again.

Proposal:
* A new interface org.apache.camel.spi.InMemoryStrategy with the method boolean 
isInMemory(). It returns true when the data is kept only in the memory of this 
JVM, so the data is lost when the application stops. A store that can be 
configured either way answers for the configuration in use.
* Implemented by MemoryIdempotentRepository, MemoryAggregationRepository, 
MemoryStateRepository, MemoryKeyValueRepository, InMemorySagaService and the 
two Caffeine repositories. The configurable caches (Ehcache, JCache, Spring 
cache, Infinispan) and the seda endpoint can follow.
* JMX: the idempotent consumer and aggregate MBeans name their repository and 
say whether it is in memory. The managed stores have an InMemory attribute.
* The processor-detail dev console shows the state of each processor and route 
input: the repository, and whether it is in memory. This includes the default 
repository of a file consumer with noop=true.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to