Fix #542: correct the couchbase-source statement example - #3009
Merged
Conversation
The example shipped in apache#3007 -- SELECT * FROM `travel-sample` LIMIT 10 -- does not work, and fails in the worst way: the source polls happily and emits nothing. Two requirements, both found by running the Kamelet against a live cluster while writing the integration test in apache#3008: CouchbaseConsumer reads row.getString("__id") and skips any row without that field, logging a warning rather than failing. A query that does not alias the document id as __id therefore produces no exchanges at all. The consumer runs the query through scope.query(...), so the keyspace resolves as <bucket>._default.<what-you-wrote>. Naming the bucket gives <bucket>._default.<bucket> and fails with "Keyspace not found"; the collection, normally _default, is what belongs there. The example now matches what the integration test actually uses, and the description states both requirements so the next person does not have to rediscover them from a silent no-op. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tz352mt7yzGWLfvYTBo2Dk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixing a defect I introduced in #3007.
The
statementexample shipped there does not work:and it fails in the worst possible way — the source polls happily, logs nothing alarming, and emits no exchanges at all.
Two requirements, neither obvious
Both found by running the Kamelet against a live Couchbase while writing the integration test in #3008.
1. The document id must be aliased as
__id.CouchbaseConsumerdoes:A query without
META().id AS __idhas every row skipped — at WARN level, so a route looks healthy and simply never fires.2. The keyspace is the collection, not the bucket. The consumer runs the query through
scope.query(...), soFROM <bucket>resolves to<bucket>._default.<bucket>:The collection — normally
_default— is what belongs there.The change
Description only — no template or behavioural change. The example now matches exactly what the integration test in #3008 uses and is proven to work against a real cluster.
Kept separate from #3008 deliberately: that PR adds a test, this one corrects a Kamelet, and they are reviewable independently even though the same investigation produced both.
script/validatorreports no errors andmvn clean installpasses with tests from the repository root.Claude Code on behalf of Andrea Cosentino