davsclaus opened a new pull request, #28141: URL: https://github.com/apache/camel/pull/28141
[CAMEL-25860](https://issues.apache.org/jira/browse/CAMEL-25860): when a pollEnrich (or poll) times out, the default aggregation sets the body to null, and with `variableReceive` the variable gets that null body. In a route whose message creates its body on demand, the null did not stick: `MessageSupport.getBody()` calls `createBody()` for a null body. So the next read brought the original body back. The message of a file consumer (`GenericFileMessage`) creates its body from its file. So after a timeout, the body, or the variable of variableReceive, was the file of the exchange instead of null: ``` 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 ``` The messages of JMS, sjms, mail, HTTP, XMPP, SMPP, SNMP and Spring WS consumers create their body on demand as well, so there the body was the payload of the consumer again. Found in a benchmark of Oct 19-20 2026: in an enrich example, 5 of 12 runs got "Key: name not found in bean: .../orders/order-1001.json of type: java.io.File" from `${variable.customer[name]}`. - `PollEnricher.CopyAggregationStrategy`, when nothing was polled: if the message still has a body after `setBody(null)`, it is replaced by a plain `DefaultMessage` with the same message id, headers and attachments (`copyFromWithNewBody`), so the body stays null. Other messages are left as they are. ## Tests - New `PollEnrichTimeoutFileBodyTest` (camel-core, 3): a route from a file consumer whose pollEnrich times out gets a null body; with variableReceive, a null variable and the order as the body; a message that creates its body on demand gets a null body and keeps its headers. Without the change, all three fail (the body and the variable are the order file, or the payload again). - The enricher tests of camel-core and the other poll tests pass (140). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
