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

   [CAMEL-25502](https://issues.apache.org/jira/browse/CAMEL-25502)
   
   An exchange cut off because its route or the CamelContext is being stopped 
(a route stop, a dev-mode reload, the graceful shutdown timing out) failed with 
a plain `RejectedExecutionException`. That cannot be told apart from a real 
rejection (a full thread pool or queue): CAMEL-25484 recognised the cut-off by 
its message text, and the error registry recorded it as an error although 
nothing in the route failed.
   
   **New exception**
   - `org.apache.camel.RouteStoppingException extends 
RejectedExecutionException`, so `onException(RejectedExecutionException.class)` 
and catch blocks keep matching.
   
   **Where it is set** (an in-flight exchange cut off by a stop):
   - the error handler (run not allowed) - the CAMEL-25484 case
   - a `direct` producer interrupted by a forced stop while waiting for a 
consumer (was `DirectConsumerNotAvailableException`; the `InterruptedException` 
stays the cause)
   - Delay and Throttle (`DelayProcessorSupport`, the throttlers), Threads, the 
Failover load balancer, the Resequencer while they stop
   - `CamelInternalProcessor` / `SharedCamelInternalProcessor` on a forced 
shutdown
   
   **Left as `RejectedExecutionException`**
   - real rejections: `SizedScheduledExecutorService`, 
`ThreadPoolRejectedPolicy`, `BoundedExecutorService`, `MulticastProcessor` task 
rejected, `ThreadsProcessor.reject()` with a full pool
   - not a cut-off: the producer/consumer caches on a stopped CamelContext, 
polling consumers not started, `ManagedRoute.stopAndFail`, 
`SedaEndpoint.purgeQueue`
   - borderline, unchanged: redelivery aborted while stopping (the exchange had 
already failed for real), `DefaultAsyncProcessorAwaitManager` interrupt (also a 
JMX operation), `SedaProducer` interrupted offer
   
   **Behaviour**
   - The error handler recognises the cut-off by type and logs it as one WARN 
line, now also for a CamelContext stop ("the CamelContext is being stopped").
   - The error registry leaves it out. 
`camel.errorRegistry.includeRouteStopping=true` records it too (a consumer that 
does not roll back may lose the message); the option is a JMX attribute and 
shown by the `errors` dev console (text and JSON).
   - Upgrade guide 4.23 and the error registry page updated; camel-main 
configurer/metadata, console and catalog regenerated.
   
   Found in the local-model benchmark (route-aggregator), with CAMEL-25484 and 
CAMEL-25500.
   
   Tests:
   - `RouteStopCutOffLogTest`: one WARN line; nothing in the error registry (3 
entries before); recorded as `RouteStoppingException` with 
`includeRouteStopping`.
   - `ShutdownWaitingAtTest`: the interrupted direct producer sets 
`RouteStoppingException` with the `InterruptedException` cause.
   - `ErrorRegistryConsoleTest`, `ErrorRegistryConfigurationPropertiesTest` 
(new, camel-main).
   - camel-core full suite green (8156 tests) before the option was added; the 
error registry, console, main and management tests after.
   
   🤖 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]

Reply via email to