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

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

> camel-core - pollEnrich: after a timeout, a message that creates its body on 
> demand (such as of a file consumer) brings its body back instead of null
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-25860
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25860
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.18.6, 4.22.3, 4.24.0
>
>
> When a pollEnrich (or poll) times out, the default aggregation sets the body 
> to null ({{PollEnricher.CopyAggregationStrategy}}), and with 
> {{variableReceive}} the variable gets that null body. In a route whose 
> message creates its body on demand, the null does not stick: 
> {{MessageSupport.getBody()}} calls {{createBody()}} for a null body, so the 
> next read brings the original body back.
> The message of a file consumer ({{GenericFileMessage}}) creates its body from 
> its file, so after the timeout the body, or the variable of variableReceive, 
> is the file of the exchange instead of null:
> {noformat}
> from: file:orders
>   pollEnrich: file:customers?fileName=${header.customer}.json, timeout 1000
>   -> body (or ${variable.customer}) is .../orders/order-1001.json when there 
> is no customer file
> {noformat}
> The messages of other consumers create their body on demand as well: JMS, 
> sjms, mail, HTTP ({{HttpMessage}}), XMPP, SMPP, SNMP and Spring WS. For them, 
> the body is the payload of the consumer again.
> Found in a benchmark of Oct 19-20 2026 (an enrich example with a pollEnrich 
> of a customer file): 5 of 12 runs got "Key: name not found in bean: 
> .../orders/order-1001.json of type: java.io.File" from 
> {{${variable.customer[name]}}}, and the model then looked for the cause 
> elsewhere.
> Proposal: when the message brings a body back after setBody(null), the 
> aggregation uses a plain message with the same headers and attachments, so 
> the body stays null.
> _Claude Code on behalf of davsclaus_



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

Reply via email to