Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/main/java/io/kurrent/dbclient/CreateProjection.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ public CreateProjection(final GrpcClient client, final String projectionName, fi

@SuppressWarnings("unchecked")
public CompletableFuture execute() {
if (engineVersion == 2 && trackEmittedStreams) {
CompletableFuture<Projectionmanagement.CreateResp> result = new CompletableFuture<>();
result.completeExceptionally(new IllegalArgumentException(
"trackEmittedStreams is not supported when engineVersion is 2 (V2)"));
return result;
}

return this.client.run(channel -> {
Projectionmanagement.CreateReq.Options.Continuous.Builder continuousBuilder =
Projectionmanagement.CreateReq.Options.Continuous.newBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,14 @@ public CreateProjectionOptions emitEnabled(boolean value) {
* The engine version is pinned at create time and cannot be changed via update.
* V2 has limitations versus V1: {@code trackEmittedStreams} is rejected,
* result streams are not emitted, and bi-state projections are not supported.
*
* @throws IllegalArgumentException if {@code value} is not {@code 0}, {@code 1}, or {@code 2}.
*/
public CreateProjectionOptions engineVersion(int value) {
if (value < 0 || value > 2) {
throw new IllegalArgumentException(
"engineVersion must be 0, 1, or 2 (got " + value + ")");
}
this.engineVersion = value;
return this;
}
Expand Down
Loading