Claus Ibsen created CAMEL-27972:
-----------------------------------
Summary: camel-google-calendar: stream delivers the same events
again, P12 credentials need clientId/clientSecret, service URL shows null
Key: CAMEL-27972
URL: https://issues.apache.org/jira/browse/CAMEL-27972
Project: Camel
Issue Type: Bug
Components: camel-google-calendar
Reporter: Claus Ibsen
Fix For: 4.25.0
Found while improving the option descriptions of camel-google-calendar for
CAMEL-23832 (pull request https://github.com/apache/camel/pull/31202).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. The stream consumer delivers the same events again
{{GoogleCalendarStreamConsumer.poll}} runs the "already delivered" check of
selectUndeliveredAndMoveCursor in every mode, not only with considerLastUpdate.
Without considerLastUpdate each poll reads the same first page again and
delivers its events again, except the event(s) with the newest updated time of
the previous poll, so the re-delivery is also inconsistent. In syncFlow an
event that comes back with the same updated time (for example after the full
re-sync on HTTP 410) is dropped.
Proposed change: call selectUndeliveredAndMoveCursor only when
considerLastUpdate is true, and otherwise deliver c.getItems() as is.
h4. 2. emailAddress and p12FileName alone are rejected
{{GoogleCalendarComponent.getClient}} and
{{GoogleCalendarStreamComponent.getClient}} only reach the P12 path of
BatchGoogleCalendarClientFactory (emailAddress + p12FileName) when clientId and
clientSecret are also set. With emailAddress and p12FileName alone the endpoint
fails with "(clientId and clientSecret) or serviceAccountKey are required".
Proposed change: also take the first branch when emailAddress and p12FileName
are set.
h4. 3. Smaller issues
GoogleCalendarStreamEndpoint.getServiceUrl and
GoogleCalendarEndpoint.getServiceUrl call ObjectHelper.isNotEmpty on a boolean,
which is always true, so the stream endpoint reports
calendar-stream:null:primary when user is not set. maxResults 0 or negative is
sent to the API unchanged (isNotEmpty(int) is always true; the API accepts 1 to
2500). google-calendar-stream scopes has no defaultValue in @UriParam although
the field defaults to https://www.googleapis.com/auth/calendar.
GoogleCalendarStreamComponent.getClient checks clientId, clientSecret and
serviceAccountKey only for null, google-calendar also for blank. The scopes are
split on "," without trimming.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)