Claus Ibsen created CAMEL-27604:
-----------------------------------
Summary: camel-google-firestore: realtime listener errors lost,
nested merge fields, metadata gaps
Key: CAMEL-27604
URL: https://issues.apache.org/jira/browse/CAMEL-27604
Project: Camel
Issue Type: Bug
Components: camel-google
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-google-firestore for
CAMEL-23832 (PR https://github.com/apache/camel/pull/30939).
These are separate problems of the component; the descriptions PR only
documents the current behavior.
h4. 1. Realtime listener errors are only logged, and startup waits 30 seconds
for nothing
With {{realtimeUpdates=true}},
{{GoogleFirestoreConsumer.startRealtimeListener()}} registers a snapshot
listener. When {{onEvent}} receives a {{FirestoreException}}, it logs the error
at ERROR level and returns. The error never reaches {{bridgeErrorHandler}} or
the {{exceptionHandler}} of the consumer, so the route does not see that the
listener failed (for example on missing permissions or a wrong project).
In that case {{latch.countDown()}} is not called either. {{doStart()}} then
blocks for the full 30 seconds of {{latch.await(30, TimeUnit.SECONDS)}}. It
ignores the result of the wait and logs "Realtime listener started" as if the
start had worked.
Proposed change: pass listener errors to {{getExceptionHandler()}}, and count
the latch down on an error too. Fail the start, or at least log a WARN, when
the wait times out or the first event is an error.
h4. 2. CamelGoogleFirestoreMergeFields cannot address nested fields
{{GoogleFirestoreProducer.setDocument()}} maps each entry of the
{{CamelGoogleFirestoreMergeFields}} header with {{FieldPath.of(name)}}.
{{FieldPath.of(String...)}} takes each argument as one segment, so
{{address.city}} becomes a single top-level field literally named
{{address.city}}, not the nested field {{city}} of {{address}}. A user who
merges a nested field gets an error from the SDK (the field is not in the data)
or writes the wrong field.
Proposed change: use {{FieldPath.fromDotSeparatedString(name)}}, which matches
the dotted field paths of {{updateDocument}} and of the Firestore docs.
h4. 3. operation has no defaultValue in the metadata
{{GoogleFirestoreProducer.process()}} performs {{setDocument}} when neither the
{{operation}} option nor the {{CamelGoogleFirestoreOperation}} header is set.
The {{@UriParam}} of {{operation}} in {{GoogleFirestoreConfiguration}} has no
{{defaultValue}}, so the catalog and the tooling show no default.
Proposed change: add {{defaultValue = "setDocument"}}, or document it as the
default only.
h4. 4. firestoreClient has no label
The {{firestoreClient}} option in {{GoogleFirestoreConfiguration}} has a plain
{{@UriParam}} without a label, so it is listed among the common options. Client
options of other components, such as {{ossClient}} of alibaba-oss, use
{{advanced}}.
Proposed change: set {{label = "advanced"}}.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)