Croway opened a new pull request, #30164: URL: https://github.com/apache/camel/pull/30164
JIRA: [CAMEL-27014](https://issues.apache.org/jira/browse/CAMEL-27014) - `JmsPollingConsumer` (used by `pollEnrich` and `ConsumerTemplate`) received with `JmsTemplate.receive()`, which closes the JMS consumer and session before it returns, and the body was read later. The Artemis client streams the body of a large message through the consumer, so reading it failed with `AMQ219023` (with or without `artemisStreamingEnabled`). With `transacted=true` the session was committed before the body was read. - `CamelJmsTemplate` gets `receiveSelectedAndApply(selector, function)`: it receives as `JmsTemplate.doReceive` does (transaction timeout, commit, client acknowledge), but applies the function to the message before it acknowledges or commits and before it closes the consumer. - `JmsPollingConsumer` uses it to create the exchange and read the body and the headers while the session is open. A body that cannot be read now fails the receive, and a transacted receive is rolled back. A custom `jmsOperations` that is not a `CamelJmsTemplate` keeps the previous behaviour. - `JmsObjectMessageEnabledTest`: the `ObjectMessage` refusal is now thrown by `consumer.receive(...)` instead of by `getBody()`. Tests: `JmsPollingConsumerLargeMessageTest` (embedded Artemis, `minLargeMessageSize=1024`, 200 KB body): ConsumerTemplate, ConsumerTemplate with `artemisStreamingEnabled`, selector, pollEnrich, transacted commit, client acknowledge, and transacted rollback of an unreadable body. These 7 fail on main and pass with the fix. Controls (small message, route consumer of a large message) pass on both. Upgrade guide: 4.24 entry "camel-jms - pollEnrich and ConsumerTemplate read the message before they close the session". The JMS component page says when the body is read. _Claude Code on behalf of Federico Mariani_ -- 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]
