allthingssecurity opened a new pull request, #30311: URL: https://github.com/apache/camel/pull/30311
# Description [CAMEL-27084](https://issues.apache.org/jira/browse/CAMEL-27084) At startup the `newIssues` consumer searches for the latest issue of the JQL (`ORDER BY created DESC`, one result), so that it routes only the issues created after it started. `findLatestIssue` caught every exception of that search and returned null, the same as for a JQL that matches no issue. So when that one search failed (a 429 or 5xx answer of Jira, a timeout of that call), the start went on (the start also reads the user's time zone, which is not caught, so a Jira that cannot be reached at all still fails the start, as before), and the first poll, with no latest issue, ran the plain JQL and routed the first page (`maxResults`, 50 by default) of the issues that already existed as new issues. A route that creates something per new issue did it again for issues that an earlier run had handled. Fix, in `NewIssuesConsumer`: - the start still does the lookup; a failure is logged at WARN instead of being taken as "no issues"; - until the lookup succeeded, a poll does the lookup again and routes nothing; a failure there fails the poll (the poll strategy logs it and the next poll tries again), and the existing `poll()` handling of a `RestClientException` with a 4xx/5xx code (reconnect) applies to it; - a JQL that matches no issue still starts without a latest issue, as before, and the start of a stopped consumer looks the latest issue up again, as before. - an issue created after the start and before the first lookup that succeeds is older than the latest issue found then, so it is not routed (on main it was routed, together with up to `maxResults` issues that already existed). The gap is the time until the next poll that reaches Jira. Test: `NewIssuesConsumerStartupLookupFailsTest` (Mockito search client, as the other consumer tests): the first search for the latest issue throws, the plain JQL returns three existing issues, and the search for newer issues returns one new issue once. Only the new issue may be routed, and the latest issue must be looked up a second time. On main the route gets the three existing issues and the new one. With the change the camel-jira unit tests pass (64 run, 0 failures), and the new test passes 20 times in one JVM. # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it): [CAMEL-27084](https://issues.apache.org/jira/browse/CAMEL-27084). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. (I built the core modules and camel-jira with the formatter and import-sort plugins; no option, doc or generated file changes. I did not run the full root build.) # AI-assisted contributions - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used. This PR was prepared with Claude Code (Claude Opus 5.5). The commit carries a `Co-Authored-By` trailer. _Claude Code on behalf of allthingssecurity_ 🤖 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]
