Repository navigation
Conversation
Replace useView=true + DesignDocument/View setup with the SQL++ (N1QL) consumer mode, which is the default (useView=false). The test now creates a primary index on the bucket so the auto-generated SQL++ query works.
The Couchbase query service may not yet be reachable when the KV bucket becomes ready. The SDK topology may also not reflect the external port mappings until after the first bootstrap completes. Use fresh Cluster connections with retry (10 attempts, 3s apart) to handle both cases.
Add cluster.waitUntilReady() after Cluster.connect() to ensure the query service is registered in the cluster topology before attempting to create buckets and primary indexes. Without this, the Couchbase SDK may report ServiceNotAvailableException on createPrimaryIndex because the cluster topology snapshot obtained at connect time does not yet include the query service endpoint (Couchbase 8.0 initialises services in parallel). Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Removes the deprecated MapReduce View API from the
couchbase-logexample and replaces it with the SQL++ (N1QL) consumer mode, which is the default.Root cause
The
couchbase-logexample was using the deprecated MapReduce View API (useView=truein the route URI,DesignDocument/Viewsetup in the test). Couchbase has deprecated this API in favour of SQL++/N1QL. The example should use the default N1QL consumer mode.Changes
MyRouteBuilder.java: RemoveuseView=truefrom the route URI. The SQL++ consumer mode is the default (useView=false), so no parameter is needed.CouchbaseTest.java: ReplaceDesignDocument/Viewsetup with:cluster.waitUntilReady(Duration.ofSeconds(30))afterCluster.connect()to ensure all cluster services (including query) are registered in the topology before proceeding — without this,ServiceNotAvailableExceptionmay be thrown on Couchbase 8.0.3 (services initialise in parallel).cluster.bucket(BUCKET).waitUntilReady()after bucket creation.createPrimaryIndexWithRetry()to create a primary index so the auto-generated SQL++ query works, with retry logic for cases where the query service needs extra time to become reachable.Test coverage
The existing
CouchbaseTest.should_consume_bucket()test verifies that 10 documents inserted into Couchbase are consumed via the SQL++ route and reach thelog:infoendpoint.Fixes: CAMEL-23626