allthingssecurity opened a new pull request, #27588:
URL: https://github.com/apache/camel/pull/27588

   # Description
   
   [CAMEL-25361](https://issues.apache.org/jira/browse/CAMEL-25361)
   
   Follow-up to #27347 (CAMEL-25221), with two small defects found while 
preparing it.
   
   - **View body.** With `useView=true&fullDocument=false` the body was 
`row.valueAs(Object.class)`, which the Couchbase SDK 3 returns as an 
`Optional`, so routes received `Optional[value]` (or `Optional.empty` when the 
view emitted `null`). The body is now the value, or `null` when the view 
emitted none. The SQL++ path is not affected (it uses the row as a JSON 
string). The code dates from CAMEL-15792 (3.7), so 4.14.x and 4.18.x have it 
too; as it changes what routes receive, the upgrade guide mentions it (a new 
`==== useView=true with fullDocument=false` subsection of the existing `=== 
camel-couchbase` section).
   - **`fullDocument` default.** The field defaults to `true`, but `@UriParam` 
said `defaultValue = "false"`, so the component JSON, catalog and endpoint DSL 
documented the wrong default. `true` is the intended default: it keeps the 
behaviour from before the option existed (the consumer always fetched the 
document), and the SQL++ section of the component page already says so. Only 
the annotation changes; the generated files are regenerated. No runtime change.
   - **Upgrade note asked for by @davsclaus in the review of #27347**, under 
the existing `==== consumerProcessedStrategy=delete`: a view or SQL++ query 
that returns several rows for one document now delivers only the first of these 
rows with `delete`. I checked that against the code: the first row marks the 
document in progress, the later rows are skipped, and the completed exchange 
removes the document. In 4.22 the next row of the already removed document 
failed the whole poll.
   
   Not included: the other suggestion from that review, clearing the in-flight 
set in `doStop`/`doStart`. I said in #27347 that I would add it, but 
`stopRoute`/`startRoute` does not reuse the consumer: `RouteService` sets the 
route up again and `DefaultRoute.initializeServices` calls 
`endpoint.createConsumer`, so the set starts empty after a route restart. The 
set survives only a stop and start of the same consumer instance (for example a 
route policy that stops and starts the consumer). There, clearing it would let 
the next poll read again a document whose exchange is still being processed, so 
I left it as is; happy to clear it in `doStart` if you prefer bounding the set 
over that duplicate.
   
   Tests: new `CouchbaseConsumerBodyTest` (mocked cluster). 
`theValueEmittedByTheViewIsTheBodyWithoutFullDocument` and 
`theBodyIsNullWhenTheViewEmitsNoValue` fail without the change (two runs; 
`expected: <[{name=Alice}, Bob]> but was: <[Optional[{name=Alice}], 
Optional[Bob]]>`). Module: 59 tests, 0 failures (the Docker ITs are skipped).
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     (I built and tested the affected module, including the formatter and 
import-sort plugins, and regenerated the catalog and endpoint DSL files for 
camel-couchbase. I did not run the full root build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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

Reply via email to