Claus Ibsen created CAMEL-27605:
-----------------------------------
Summary: camel-infinispan-embedded: unused eventTypes, endpoint
options ignored, header metadata
Key: CAMEL-27605
URL: https://issues.apache.org/jira/browse/CAMEL-27605
Project: Camel
Issue Type: Bug
Components: camel-infinispan
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-infinispan-embedded for
CAMEL-23832 (PR https://github.com/apache/camel/pull/30944).
These are separate problems of the component; the descriptions PR only
documents the current behavior.
h4. 1. eventTypes accepts event types that the consumer never receives
{{InfinispanEmbeddedConsumer.ConsumerHandler.doStart()}} turns each name of
{{eventTypes}} into an {{Event.Type}} with {{Event.Type.valueOf}}, so all 16
values are accepted. The listener that it registers,
{{InfinispanEmbeddedEventListener}}, only has callbacks for 9 of them:
CACHE_ENTRY_ACTIVATED, CREATED, EXPIRED, INVALIDATED, LOADED, MODIFIED,
PASSIVATED, REMOVED and VISITED. With {{eventTypes=TOPOLOGY_CHANGED}} (or
CACHE_ENTRY_EVICTED, TRANSACTION_COMPLETED, TRANSACTION_REGISTERED,
DATA_REHASHED, PARTITION_STATUS_CHANGED, PERSISTENCE_AVAILABILITY_CHANGED) the
route starts, but the consumer never receives an event, and nothing is logged.
The names are also not trimmed, so {{CACHE_ENTRY_CREATED, CACHE_ENTRY_REMOVED}}
(with a space) fails at startup with an IllegalArgumentException.
Proposed change: fail at startup (or log a WARN) for an event type that the
listener cannot receive, and trim the names.
h4. 2. cacheContainer, cacheContainerConfiguration, configurationUri and flags
are silently ignored on an endpoint
{{InfinispanEmbeddedComponent.doInit()}} creates one
{{InfinispanEmbeddedManager}} from the configuration of the component, and
every endpoint uses it. The endpoint gets a clone of that configuration, and
its own values of these four options are never read:
{{InfinispanEmbeddedManager.doStart()}} and {{getCache(...)}} only look at the
component configuration. A user who writes
{{infinispan-embedded:mycache?configurationUri=infinispan.xml}} or
{{?flags=SKIP_CACHE_LOAD}} gets the default cache manager or no flags, without
any warning.
Proposed change: log a WARN (or fail) when one of these options is set on an
endpoint with a value that differs from the component, or mark them as
component-only options.
h4. 3. Header CamelInfinispanOldValue has label producer, but the consumer sets
it
{{InfinispanEmbeddedEventListener.processEvent(CacheEntryRemovedEvent)}} sets
{{CamelInfinispanOldValue}} to {{event.getOldValue()}}, but
{{InfinispanConstants.OLD_VALUE}} has {{label = "producer"}}. The header is
therefore listed for the producer only in the documentation and the catalog.
Proposed change: make the label common (both consumer and producer).
h4. 4. Header CamelInfinispanCurrentState is always false
{{InfinispanEmbeddedEventListener}} sets {{CamelInfinispanCurrentState}} to
{{event.isCurrentState()}}, but none of the listeners in
{{InfinispanEmbeddedEventListeners}} sets {{includeCurrentState = true}} in its
{{@Listener}} annotation, so Infinispan never generates current-state events
for them and the header is always false.
Proposed change: add a consumer option for {{includeCurrentState}}, or stop
setting and documenting the header.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)