Skip to content

CAMEL-23626: Remove deprecated MapReduce View from couchbase-log example - #299

Open
gnodet wants to merge 4 commits into
apache:mainfrom
gnodet:CAMEL-23626-remove-deprecated-view
Open

gnodet wants to merge 4 commits into
apache:mainfrom
gnodet:CAMEL-23626-remove-deprecated-view

Conversation

@gnodet

@gnodet gnodet commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Removes the deprecated MapReduce View API from the couchbase-log example and replaces it with the SQL++ (N1QL) consumer mode, which is the default.

Root cause

The couchbase-log example was using the deprecated MapReduce View API (useView=true in the route URI, DesignDocument/View setup 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: Remove useView=true from the route URI. The SQL++ consumer mode is the default (useView=false), so no parameter is needed.
  • CouchbaseTest.java: Replace DesignDocument/View setup with:
    • cluster.waitUntilReady(Duration.ofSeconds(30)) after Cluster.connect() to ensure all cluster services (including query) are registered in the topology before proceeding — without this, ServiceNotAvailableException may 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 the log:info endpoint.

Fixes: CAMEL-23626

gnodet and others added 4 commits November 9, 2026 14:34
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant