davsclaus opened a new pull request, #29760: URL: https://github.com/apache/camel/pull/29760
Fixes [CAMEL-26715](https://issues.apache.org/jira/browse/CAMEL-26715) A polling route (file, ftp, sql, jpa, ...) with nothing to do looks the same as one whose scheduler has stopped: no exchanges. The counters do not help much: 123 empty polls is two minutes or twelve seconds depending on the delay. A time does: "polled nothing for 47s, last poll 500ms ago". ## Changes - **`ScheduledPollConsumer`** (camel-support) keeps: - `getLastPollTimestamp()`: the last poll, also a poll that failed (so a consumer that keeps failing is seen polling); - `getLastPollMessagesTimestamp()` / `getLastPollMessagesCount()`: the last poll that polled messages, and how many it polled. The times are read from `TimeSource`, so a deterministic simulation test runs them in virtual time. `TimeSourceDirectClockCallsTest` now lists the class (and `test-dst.adoc` names it). They are 0 until the consumer polls, and are cleared when the consumer stops, as the counters are. A poll that runs while the consumer is being stopped does not set them (the existing generation check). - **JMX** (`ManagedSchedulePollConsumerMBean`, `@since 4.24`): `LastPollTimestamp`, `LastPollMessagesTimestamp` (null when none) and `LastPollMessagesCount`. - **consumer dev console**: `lastPollTimestamp`, `lastPollMessagesTimestamp`, `lastPollMessagesCount` in the JSON (only present once there is one), `Last Poll: 2s ago` and `Last Poll With Messages: 47s ago (messages: 3)` in the text. - **timeline dev console**: each route from a scheduled poll consumer has a `polling` object in the JSON. In the text, a polling route that did nothing in the seconds says `(polled nothing for 47s, last poll 500ms ago)`, `(polled nothing since the consumer started, last poll ...)` or `(not polled yet)`. - Catalog dev console JSONs regenerated. The Timeline and About screens of the TUI (CAMEL-26700) will use this in a follow-up PR. ## Tests - `ScheduledPollConsumerLastPollTest` (camel-core): with a fixed `TimeSource` clock, an empty poll, a poll of 3 messages, an empty poll and a failing poll, and the reset on stop. - `ManagedScheduledPollConsumerLastPollTest` (camel-management): the JMX attributes on a file consumer. - `ConsumerDevConsoleLastPollTest` and `TimelineDevConsolePollingTest` (camel-console): the JSON and text of both consoles, and the wording of a quiet route. - Ran the scheduled poll consumer tests and `TimeSourceDirectClockCallsTest` of camel-core (19), the managed scheduled poll consumer tests, and the whole camel-console suite (291): all pass. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
