shashank created CAMEL-27084:
--------------------------------
Summary: camel-jira - when the search for the latest issue fails
at startup, the newIssues consumer routes the existing issues as new ones
Key: CAMEL-27084
URL: https://issues.apache.org/jira/browse/CAMEL-27084
Project: Camel
Issue Type: Bug
Components: camel-jira
Reporter: shashank
Assignee: shashank
h3. What happens
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}} catches every exception of that
search and returns null, the same as for a JQL that matches no issue.
When the search fails (a 429 or 5xx answer of Jira, a timeout, a network
error), the start goes on, and the first poll, finding no latest issue, runs
the plain JQL and routes the first page (maxResults, 50 by default) of the
issues that already existed as new issues. A route that creates something per
new issue (a ticket elsewhere, a notification) does it again for issues an
earlier run already handled.
h3. How to reproduce
{{NewIssuesConsumerStartupLookupFailsTest}} (camel-jira, Mockito search
client): 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. The route receives the three existing issues and the new one; only the
new one is expected.
h3. Fix
A failed lookup at startup is logged at WARN and done again at the next poll,
before any issue is routed (a failure then fails that poll, which the poll
strategy handles). A JQL that matches no issue still starts with no latest
issue, as before.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)