Dhairya-007 opened a new pull request, #29976:
URL: https://github.com/apache/camel/pull/29976

   ## Problem
   
   The five headers under the `// Response metadata` comment are named for a 
response, and that is mostly what they are - `GoogleFirestoreProducer` sets 
them on every operation that answers with a document, 18 `setHeader` calls 
across `createDocument`, `setDocument`, `getDocument`, `updateDocument`, 
`deleteDocument` and the batch path:
   
   ```java
   message.setHeader(GoogleFirestoreConstants.RESPONSE_DOCUMENT_ID, documentId);
   message.setHeader(GoogleFirestoreConstants.RESPONSE_DOCUMENT_PATH, 
docRef.getPath());
   message.setHeader(GoogleFirestoreConstants.RESPONSE_UPDATE_TIME, 
result.getUpdateTime());
   ```
   
   and, for `getDocument`:
   
   ```java
   message.setHeader(GoogleFirestoreConstants.RESPONSE_DOCUMENT_ID, 
document.getId());
   message.setHeader(GoogleFirestoreConstants.RESPONSE_DOCUMENT_PATH, 
docRef.getPath());
   message.setHeader(GoogleFirestoreConstants.RESPONSE_CREATE_TIME, 
document.getCreateTime());
   message.setHeader(GoogleFirestoreConstants.RESPONSE_UPDATE_TIME, 
document.getUpdateTime());
   message.setHeader(GoogleFirestoreConstants.RESPONSE_READ_TIME, 
document.getReadTime());
   ```
   
   All five nonetheless carry `label = "consumer"`:
   
   ```java
   // Response metadata
   @Metadata(label = "consumer", description = "The document ID from the 
response.", javaType = "String")
   public static final String RESPONSE_DOCUMENT_ID = 
"CamelGoogleFirestoreResponseDocumentId";
   ```
   
   so the catalog files them under the consumer group alone, and a producer 
route - the component's main use - finds the id, path and timestamps of the 
document it has just written documented for the side it is not on.
   
   ## Fix
   
   Drop the `consumer` label from the five, so they land in `common`, which is 
where a header that both sides set belongs.
   
   `CamelGoogleFirestoreChangeType`, declared right after them, keeps its 
`consumer` label: that one really is set by the realtime listener alone, and 
its description already says "Only set when realtimeUpdates is enabled".
   
   No header name, type or behaviour changes. The regenerated 
`google-firestore.json` files are included; header entries keep their 
declaration order, so only the group and label fields move.


-- 
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]

  • [PR] camel-google-firestore: ... Dhairya-007 (via GitHub) via commits

Reply via email to