Latency in executing queries from a messaging queue (Couchbase SDK 3.x) after package upgrade

I have a messaging queue which is reading the messages and doing DB operations like select and upsert , FYI - i execute query on code
example :
var queryResult = await _cluster.QueryAsync(queryStatementInsert,
new QueryOptions()
.Parameter(“$id”, couchbaseSpaStatusModel.Id))
.ConfigureAwait(false);

Before it was
var result = await this.Bucket.GetDocumentAsync(couchbaseDocumentKey).

Since the server is not upgraded i couldn’t use Bucket.GetDocumentAsync because the new upgrade has Scopes and collections which is not there in the server, so i hade this challenge of using query to do DB operations and its making latency and sometimes “WaitAsync” exceptions and stalling the whole process

please provide me with a better approach to get messages from a queue and do DB operations with the upgraded package and old server which has no scopes and collections.
Note: i receive 5+ messages per seconds in the queue, so need to read and process it as fast as i receive

Thanks in advance.

Hi @139751
It sounds like you are using a modern Couchbase SDK against an older Couchbase Server, pre-7.0, that does not support scopes and collections?

While all such server versions are now EOL and no longer supported, and we do not explicitly test this combination any longer - it should work fine. If you access the default collection through the SDK, then you can perform KV operations against older servers that do not support collections. No need to use query instead.

2 Likes

Great , any examples i could use

Thanks

Sure, you can get access to the default collection like this

var cluster = await Cluster.ConnectAsync("couchbase://your-ip", "Administrator", "password");
var bucket =  await cluster.BucketAsync("your-bucket");
var collection = bucket.DefaultCollection();

And then you have the familiar KV operations (get, upsert etc.) on that collection object.

1 Like