gnodet opened a new pull request, #30741: URL: https://github.com/apache/camel/pull/30741
## Summary `HazelcastSedaConsumer` and `HazelcastQueueConsumer.QueueConsumerTask` stop consuming permanently after a `java.lang.Error` escapes their polling loop, while the route still reports `Started`. ## Root Cause Both loops catch only `Exception`. Hazelcast's `queue.poll()` deserializes the item inline and re-throws deserialization errors as-is (see `SerializationUtil.handleException`), including `NoClassDefFoundError` and `ExceptionInInitializerError` when the class of the queued body or a header is absent from the consumer's classpath. These `Error` subclasses escape the `catch (Exception e)` clause, unwind the loop, and kill the consumer thread permanently. With a single concurrent consumer (the default), the queue is then dead while the route stays `Started`. ## Fix Add `catch (Error e)` after `catch (Exception e)` in both loops: - **`HazelcastSedaConsumer.run()`** — the outer try/catch that wraps body-is-not-null processing. `VirtualMachineError` (`OutOfMemoryError`, `StackOverflowError`, …) is re-thrown as unrecoverable; all other `Error` subclasses roll back the transaction (if any) and route through the exception handler, then wait the configured `onErrorDelay` before the next poll. - **`HazelcastQueueConsumer.QueueConsumerTask.run()`** — two positions: the try/catch wrapping `queue.poll()` (poll errors), and the try/catch wrapping `processor.process()` (processing errors). Same VirtualMachineError carve-out applies. ## Tests Two new unit tests using Mockito mocks of the Hazelcast queue: - `HazelcastQueueConsumerPollErrorThrowableTest.testKeepsPollingAfterError` — first poll throws `NoClassDefFoundError`, second poll returns an item; asserts the item is received. - `HazelcastSedaConsumerPollErrorThrowableTest.testKeepsPollingAfterError` — same scenario for the seda consumer. Both tests fail on the unfixed code and pass on the fixed code. Full module `verify` (including ITs) passes. Fixes CAMEL-27474 --- _Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_ -- 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]
