shashank created CAMEL-24930:
--------------------------------

             Summary: Resequence EIP docs say the last of duplicate messages is 
kept, but the first one is kept
                 Key: CAMEL-24930
                 URL: https://issues.apache.org/jira/browse/CAMEL-24930
             Project: Camel
          Issue Type: Task
          Components: camel-core
            Reporter: shashank


{{resequence-eip.adoc}} says: "By default, the Resequencer does not support 
duplicate messages and will only keep the last message, in case a message 
arrives with the same message expression." The "Allow Duplicates" section 
repeats this ("instead of keeping only the last duplicated message").

Both resequencers keep the *first* message and drop the later ones:

* Batch: {{Resequencer.createSet}} uses a {{TreeSet}}, which ignores an element 
equal to one it already holds. 
{{BatchResequencerWithDuplicateTest.testBatchResequencerNoDuplicate}} sends 
A(1), C(2), D(2), F(4), B(1), E(3) and asserts A, C, E, F.
* Stream: {{ResequencerEngine.insert}} calls {{sequence.add(element)}} on a 
{{TreeSet}} as well. Sending B(2), A1(1), A2(1) to 
{{resequence(header("seqno")).stream()}} delivers A1, B. A2 is dropped.

Proposed fix: correct the two sentences in the docs (the code behaviour is 
covered by an existing test, so it is the docs that are wrong), and add a test 
for the stream mode.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to