Class SubscriptionQueryStream
- java.lang.Object
-
- io.axoniq.axonserver.connector.impl.FlowControlledStream<SubscriptionQueryResponse,SubscriptionQueryRequest>
-
- io.axoniq.axonserver.connector.query.impl.SubscriptionQueryStream
-
- All Implemented Interfaces:
io.grpc.stub.ClientResponseObserver<SubscriptionQueryRequest,SubscriptionQueryResponse>,io.grpc.stub.StreamObserver<SubscriptionQueryResponse>
public class SubscriptionQueryStream extends FlowControlledStream<SubscriptionQueryResponse,SubscriptionQueryRequest>
AFlowControlledStreamimplementation to return the results of aSubscriptionQuery.
-
-
Constructor Summary
Constructors Constructor Description SubscriptionQueryStream(String subscriptionQueryId, CompletableFuture<QueryResponse> initialResultFuture, String clientId, Supplier<ResultStream<QueryResponse>> initialResultSupplier, int bufferSize, int fetchSize)Instantiates aSubscriptionQueryStreamto streamSubscriptionQueryresults.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeforeStart(io.grpc.stub.ClientCallStreamObserver<SubscriptionQueryRequest> requestStream)protected SubscriptionQueryRequestbuildFlowControlMessage(FlowControl flowControl)Build a flow control message of typeOUTbased on the givenflowControl.voidenableFlowControl()Enables flow control for this stream.ResultStream<QueryResponse>initialStream()Returns theResultStreambuffering the initial results to this subscription query.voidonCompleted()voidonError(Throwable t)voidonNext(SubscriptionQueryResponse value)ResultStream<QueryUpdate>updatesBuffer()Returns theResultStreambuffering theQueryUpdates to this subscription query.-
Methods inherited from class io.axoniq.axonserver.connector.impl.FlowControlledStream
buildInitialFlowControlMessage, markConsumed, outboundStream
-
-
-
-
Constructor Detail
-
SubscriptionQueryStream
public SubscriptionQueryStream(String subscriptionQueryId, CompletableFuture<QueryResponse> initialResultFuture, String clientId, Supplier<ResultStream<QueryResponse>> initialResultSupplier, int bufferSize, int fetchSize)
Instantiates aSubscriptionQueryStreamto streamSubscriptionQueryresults.- Parameters:
subscriptionQueryId- the identifier of this subscription queryclientId- the identifier of the client initiating the subscription queryinitialResultSupplier- aSupplierproviding the initialResultStreamof the subscription querybufferSize- the size of the updateupdatesBuffer()fetchSize- the number of updates to be consumed prior to refilling the updateupdatesBuffer()
-
-
Method Detail
-
updatesBuffer
public ResultStream<QueryUpdate> updatesBuffer()
Returns theResultStreambuffering theQueryUpdates to this subscription query.- Returns:
- the
ResultStreambuffering theQueryUpdates to this subscription query
-
initialStream
public ResultStream<QueryResponse> initialStream()
Returns theResultStreambuffering the initial results to this subscription query.- Returns:
- the
ResultStreambuffering the initial results to this subscription query
-
onNext
public void onNext(SubscriptionQueryResponse value)
-
onError
public void onError(Throwable t)
-
onCompleted
public void onCompleted()
-
beforeStart
public void beforeStart(io.grpc.stub.ClientCallStreamObserver<SubscriptionQueryRequest> requestStream)
- Specified by:
beforeStartin interfaceio.grpc.stub.ClientResponseObserver<SubscriptionQueryRequest,SubscriptionQueryResponse>- Overrides:
beforeStartin classFlowControlledStream<SubscriptionQueryResponse,SubscriptionQueryRequest>
-
enableFlowControl
public void enableFlowControl()
Description copied from class:FlowControlledStreamEnables flow control for this stream. Will only set up flow control if the permits batch size is larger than0.- Overrides:
enableFlowControlin classFlowControlledStream<SubscriptionQueryResponse,SubscriptionQueryRequest>
-
buildFlowControlMessage
protected SubscriptionQueryRequest buildFlowControlMessage(FlowControl flowControl)
Description copied from class:FlowControlledStreamBuild a flow control message of typeOUTbased on the givenflowControl.- Specified by:
buildFlowControlMessagein classFlowControlledStream<SubscriptionQueryResponse,SubscriptionQueryRequest>- Parameters:
flowControl- theFlowControlmessage used to base this implementation's flow control message on- Returns:
- the message used by this implementation to request new entries of type
IN
-
-