[ 
https://issues.apache.org/jira/browse/CAMEL-26237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Guillaume Nodet reassigned CAMEL-26237:
---------------------------------------

    Assignee: Guillaume Nodet

> camel-ehcache - without a cacheManager each endpoint URI builds its own 
> CacheManager, so a GET does not find what a PUT on another endpoint stored
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26237
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26237
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ehcache
>            Reporter: Claus Ibsen
>            Assignee: Guillaume Nodet
>            Priority: Major
>             Fix For: 4.24.0
>
>
> Found while adding the catalog body types of ehcache (CAMEL-24961, PR #28397).
> h4. 1. Each endpoint URI has its own CacheManager
> {{EhcacheEndpoint.doStart}} (main 2a465aa4814c, line 70) calls 
> {{EhcacheComponent.createCacheManager}}, which without {{cacheManager}}, 
> {{cacheManagerConfiguration}} or {{configurationUri}} returns a new 
> {{CacheManager}} for each call (line 113; the other branches share one 
> through {{managers.computeIfAbsent}}). So {{ehcache:x}} and 
> {{ehcache:x?action=GET}} are two caches named x: a GET does not find what the 
> other endpoint stored. Checked on 4.24.0-SNAPSHOT with the default Ehcache 
> setup and with an XML configuration.
> Proposed: share the default CacheManager per component, as the configured 
> branches do.
> h4. 2. A consumer on a cache without configuration gets no events
> Without a cache configuration {{EhcacheManager.getCache}} (lines 115-122) 
> falls back to a {{UserManagedCache}}, and the listener the consumer registers 
> on it ({{EhcacheConsumer}} line 58) never gets an event, without a warning. 
> Checked on 4.24.0-SNAPSHOT with the default Ehcache setup and with an XML 
> configuration.
> Proposed: create a managed cache with the default configuration instead, or 
> fail (or warn) when a consumer gets a UserManagedCache.
> h4. 3. PUT, PUT_IF_ABSENT and REPLACE with no body store the Camel message
> {{EhcacheProducer.getValue}} (line 168) calls 
> {{message.getBody(Object.class)}} when there is no {{CamelEhcacheValue}} 
> header; with a null body this converts the message itself, so the cache 
> stores the {{DefaultMessage}} object instead of failing. Checked on 
> 4.24.0-SNAPSHOT with the default Ehcache setup and with an XML configuration.
> Proposed: use {{getBody()}} for Object, and fail when the value is null.
> h4. 4. valueType without keyType: "keyType cannot be null"
> {{EhcacheManager.getCache}} (lines 89-98) falls back to Object only when both 
> types are null, so {{valueType}} without {{keyType}} fails with a 
> NullPointerException "keyType cannot be null". Checked on 4.24.0-SNAPSHOT 
> with the default Ehcache setup and with an XML configuration.
> Proposed: default each type to Object (or the configured type) on its own.
> _Claude Code on behalf of davsclaus_



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

Reply via email to