davsclaus opened a new pull request, #30648:
URL: https://github.com/apache/camel/pull/30648

   [CAMEL-27425](https://issues.apache.org/jira/browse/CAMEL-27425)
   
   ## Problem
   
   When a JMS consumer route fails on a message that expects a reply (the 
message has a JMSReplyTo), Camel sends no reply, unless 
`transferException=true`. The caller waits until its `requestTimeout` and then 
fails with `ExchangeTimedOutException`. The consumer logs only the failure:
   
   ```
   Execution of JMS message listener failed. Caused by: 
[org.apache.camel.RuntimeCamelException - java.lang.Exception: not enough 
CAMEL-CAP]
   ```
   
   The timeout comes later (20 seconds by default), in the calling route, and 
its message (CAMEL-27119) cannot say that the consumer failed. Nothing links 
the two.
   
   In the local-model benchmark (connect-service-jms-request-reply step 4), the 
replying route throws when the stock is too low. In 3 runs the model saw the 
listener failure 2 or 3 times, but never the cause of the timeout. It thought 
the redelivery did not happen, and rewrote the error handler until the step 
ended. The one run that saw the timeout hint (in an earlier series) set 
`requestTimeout`, handled the timeout, and passed.
   
   ## Change
   
   When the exchange of a message that expects a reply fails, and no reply is 
sent, the exception that the consumer rethrows, and its listener container 
logs, says so. From the camel-sjms test:
   
   ```
   org.apache.camel.RuntimeCamelException: java.lang.IllegalStateException: not 
enough CAMEL-CAP. No reply is sent (JMSReplyTo 
ActiveMQTemporaryQueue[b51d8a0a-3b78-4a46-b29a-8cb622e04262]), as the exchange 
failed: the caller waits until its requestTimeout and then fails with 
ExchangeTimedOutException. To make the caller fail at once, reply with a 
message that says the request failed and check it in the caller, or set 
transferException=true to send the exception back (with 
objectMessageEnabled=true on both sides)
   ```
   
   - camel-jms: `EndpointMessageListener`; the endpoint's `errorHandler` logs 
it (by default `DefaultSpringErrorHandler`). camel-sjms: 
`EndpointMessageListener`; `SimpleMessageListenerContainer` logs it.
   - The exception is a `RuntimeCamelException`, as before, and its cause is 
the exception of the exchange. Its message starts with that exception, as 
before.
   - One difference: an exchange that failed with a `RuntimeCamelException` had 
it rethrown as it was. In this case it is now the cause of a new 
`RuntimeCamelException`.
   - A message without a JMSReplyTo fails as before. With 
`transferException=true` the exception is sent back as before. The hint names 
`objectMessageEnabled=true`, as the reply with the exception is an 
ObjectMessage, which is disabled by default.
   
   ## Tests
   
   - camel-jms `JmsInOutFailedRequestMessageTest` and camel-sjms 
`InOutConsumerFailedRequestMessageTest`: a request to a route that throws times 
out, and the failure the consumer logs says that no reply is sent. camel-jms 
reads it with an `errorHandler` that records it, camel-sjms with a log appender 
on the listener container. A message without a JMSReplyTo fails with the same 
message as before. The request test fails without the change in both modules.
   - camel-jms: 230 tests in 71 classes (`JmsInOut*`, `*TransferException*`, 
`JmsErrorHandler*`, `NoClassDefFoundError*`, `JmsConsumerExceptionHandlerTest`, 
`*Reply*`), 1 skipped. camel-sjms: 28 tests in 18 classes (`InOut*`, 
`*TransferException*`, `TransactedProducerInOutErrorTest`, 
`AsyncConsumerInOutTest`).
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_016Y4dDi5iQNgtHrDdz2NpwF
   


-- 
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]

Reply via email to