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

Claus Ibsen resolved CAMEL-27148.
---------------------------------
    Resolution: Fixed

Fixed by https://github.com/apache/camel/pull/30320 (merged as 671c1aee61f2).

_Claude Code on behalf of davsclaus_

> camel-jbang - a write note when the steps of an idempotentConsumer that skips 
> duplicates check CamelDuplicateMessage
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27148
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27148
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jbang
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> An idempotentConsumer skips a duplicate by default (skipDuplicate is true): 
> the duplicate never reaches the steps under it. It goes on with the exchange 
> property CamelDuplicateMessage set to true, but only to the steps after the 
> idempotentConsumer. A new message has no CamelDuplicateMessage property at 
> all.
> So a check of CamelDuplicateMessage in the steps under an idempotentConsumer 
> that skips duplicates is never true. For example, this route never logs a 
> duplicate:
> {code:yaml}
> - idempotentConsumer:
>     expression:
>       simple: "${body[orderId]}"
>     idempotentRepository: orderRepo
>     steps:
>       - choice:
>           when:
>             - expression:
>                 simple: "${exchangeProperty.CamelDuplicateMessage} == true"
>               steps:
>                 - log:
>                     message: "Order ${body[orderId]} is a duplicate, skipped"
>           otherwise:
>             steps:
>               - log:
>                   message: "Order ${body[orderId]} accepted"
> {code}
> A check with == false is never true either, because a new message has no such 
> property. In one run the when had == false and logged "accepted", so the 
> otherwise logged every new order as a duplicate.
> The fix is skipDuplicate: false. Then a duplicate goes on to the steps under 
> the idempotentConsumer with CamelDuplicateMessage set to true.
> In the local-model benchmark (r30 to r35, Nov 8-18 2026), step 1 of 
> route-enrich-and-dedupe asks to log the accepted orders and the skipped 
> duplicates. Every step run that set skipDuplicate: false passed (27). Every 
> step run that checked CamelDuplicateMessage without it failed (8, two of them 
> with == false). The catalog does not say it either. skipDuplicate says "Sets 
> whether to skip duplicates or not. The default behavior is to skip 
> duplicates.", and the CamelDuplicateMessage property says "Whether this 
> exchange is a duplicate detected by the Idempotent Consumer EIP".
> Proposal: the write tools of the camel-jbang-mcp server (camel_write_file and 
> camel_edit_file) give a note when the steps under an idempotentConsumer that 
> skips duplicates check CamelDuplicateMessage. The note says to add 
> skipDuplicate: false, and to check == true for a duplicate. It is a note like 
> the other write notes: the write is not refused.
> The descriptions of skipDuplicate and of the CamelDuplicateMessage property 
> could say this too. That changes the model and its generated files, so it is 
> for another ticket.



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

Reply via email to