[ 
https://issues.apache.org/jira/browse/CAMEL-24347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18103372#comment-18103372
 ] 

Andrea Cosentino commented on CAMEL-24347:
------------------------------------------

https://github.com/apache/camel/pull/25430 covers the listCollections document 
id and the defensive copy of the snapshot data.

The third item of the description - the unbounded queue of the realtime 
consumer - is deliberately NOT in that PR. Bounding it requires choosing an 
overflow policy (drop the change or block the Firestore callback thread) and 
the component exposes no maxMessagesPerPoll today, so it is a maintainer 
decision rather than a mechanical fix. Leaving this issue open for it, or it 
can be split out.

> camel-google-firestore: listCollections ignores the configured documentId and 
> the realtime queue is unbounded
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24347
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24347
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-google
>            Reporter: Andrea Cosentino
>            Assignee: Andrea Cosentino
>            Priority: Minor
>
> 1. {{listCollections}} is the only document operation that does not fall back 
> to the configured documentId:
> {code:java}
> // GoogleFirestoreProducer.java:307
> String documentId = 
> exchange.getIn().getHeader(GoogleFirestoreConstants.DOCUMENT_ID, 
> String.class);
> {code}
> Every other operation uses {{determineDocumentId()}} (:387-396), which falls 
> back to {{configuration.getDocumentId()}}. So 
> {{google-firestore:coll?documentId=x&operation=listCollections}} silently 
> lists the root collections instead of the document's sub-collections.
> 2. The realtime consumer queues without bound:
> {code:java}
> // GoogleFirestoreConsumer.java:52,96
> private final Queue<Exchange> pendingExchanges = new 
> ConcurrentLinkedQueue<>();
> ...
> pendingExchanges.add(exchange);
> {code}
> Snapshot events are appended as they arrive and only drained on the next 
> poll, so a busy collection or a slow route grows the queue without limit.
> 3. {{queryCollection}} and {{listDocuments}} inject {{_id}}/{{_path}} into 
> the document data map (:247-248, :295-296), overwriting document fields with 
> those names. The consumer exposes the same values as headers instead - the 
> producer should be consistent with it.
> Found during a source audit of the {{components/camel-google}} module family 
> against main @ c3b01310be15.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to