Skip to content

Commit 85d1aef

Browse files
committed
Allow user to set clientContextId query option.
1 parent 9da48fb commit 85d1aef

File tree

1 file changed

+6
-0
lines changed
  • couchbase-analytics-java-client/src/main/java/com/couchbase/analytics/client/java

1 file changed

+6
-0
lines changed

couchbase-analytics-java-client/src/main/java/com/couchbase/analytics/client/java/QueryOptions.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ public QueryOptions timeout(@Nullable Duration timeout) {
6464
return this;
6565
}
6666

67+
public QueryOptions clientContextId(@Nullable String clientContextId) {
68+
this.clientContextId = clientContextId;
69+
return this;
70+
}
71+
6772
public QueryOptions parameters(@Nullable Map<String, ?> namedParameters) {
6873
this.namedParameters = namedParameters == null ? null : unmodifiableMap(new HashMap<>(namedParameters));
6974
return this;
@@ -156,6 +161,7 @@ static class Unmodifiable {
156161
void injectParams(ObjectNode query) {
157162
query.put(
158163
"client_context_id",
164+
// Generating the random ID late like this means a new ID is assigned to each retry.
159165
clientContextId != null ? clientContextId : UUID.randomUUID().toString()
160166
);
161167

0 commit comments

Comments
 (0)