Andrea Cosentino created CAMEL-24491:
----------------------------------------
Summary: camel-ibm-cos: consumer in-progress deduplication is
inert, causing duplicate delivery
Key: CAMEL-24491
URL: https://issues.apache.org/jira/browse/CAMEL-24491
Project: Camel
Issue Type: Bug
Reporter: Andrea Cosentino
Assignee: Andrea Cosentino
Fix For: 4.23.0
IBMCOSConsumer is meant to skip objects already being processed, via the
endpoint's in-progress IdempotentRepository, but the deduplication never works:
1. createExchanges() only CHECKS the repository
(getInProgressRepository().contains(key)) and never ADDS the key, so contains()
is always false and every polled object is (re-)delivered — including objects
still being processed by an overlapping poll when deleteAfterRead/moveAfterRead
is off (at-least-once turns into duplicate delivery).
2. The repository is a MemoryIdempotentRepository service, but
IBMCOSEndpoint.doStart() only starts it (ServiceHelper.startService) AFTER two
early returns — when a fileName is configured, or when the bucket already
exists (the normal consuming case). So in practice the repository is never
started.
3. processCommit()/processRollback() never remove the key from the repository.
Fix (mirroring camel-aws2-s3 AWS2S3Consumer, which this module was copied
from): use getInProgressRepository().add(key) as the atomic guard (skip when it
returns false), remove the key in processCommit (finally) and processRollback,
and start the in-progress repository before the early returns in doStart().
Affected: components/camel-ibm/camel-ibm-cos
(org.apache.camel.component.ibm.cos.IBMCOSConsumer, IBMCOSEndpoint).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)