Skip to content
Merged
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
22 changes: 22 additions & 0 deletions java/client/src/main/java/io/vitess/client/VTGateConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import io.vitess.proto.Vtgate.SplitQueryRequest;
import io.vitess.proto.Vtgate.SplitQueryResponse;
import io.vitess.proto.Vtgate.StreamExecuteRequest;
import io.vitess.proto.Vtgate.VStreamRequest;
import io.vitess.proto.Vtgate.VStreamResponse;

import java.io.Closeable;
import java.io.IOException;
Expand Down Expand Up @@ -252,6 +254,26 @@ public ListenableFuture<List<SplitQueryResponse.Part>> apply(
}, directExecutor()));
}

/**
* Starts streaming the vstream binlog events.
*
* @param ctx Context on user and execution deadline if any.
* @param vstreamRequest VStreamRequest containing starting VGtid positions
* in binlog and optional Filters
* @return Streaming iterator over VStream events
* @throws SQLException If anything fails on query execution.
*/
StreamIterator<VStreamResponse> getVStream(Context ctx, VStreamRequest vstreamRequest)
throws SQLException {
VStreamRequest request = vstreamRequest;

if (ctx.getCallerId() != null) {
request = request.toBuilder().setCallerId(ctx.getCallerId()).build();
}

return client.getVStream(ctx, request);
}

/**
* @inheritDoc
*/
Expand Down