Class PersistentStreamImpl
- java.lang.Object
-
- io.axoniq.axonserver.connector.event.impl.PersistentStreamImpl
-
- All Implemented Interfaces:
PersistentStream,io.grpc.stub.ClientResponseObserver<StreamRequest,StreamSignal>,io.grpc.stub.StreamObserver<StreamSignal>
public class PersistentStreamImpl extends Object implements PersistentStream, io.grpc.stub.ClientResponseObserver<StreamRequest,StreamSignal>
Implementation of thePersistentStream.
-
-
Constructor Summary
Constructors Constructor Description PersistentStreamImpl(ClientIdentification clientId, String streamId, int bufferSize, int refillBatch, PersistentStreamCallbacks callbacks)Constructs aPersistentStreamImpl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeforeStart(io.grpc.stub.ClientCallStreamObserver<StreamRequest> clientCallStreamObserver)voidclose()Closes the persistent stream.voidonCompleted()voidonError(Throwable throwable)voidonNext(StreamSignal streamSignal)voidopenConnection()Sends an open request to Axon Server to start a persistent stream connection.voidopenConnection(InitializationProperties initializationProperties)Sends an open request to Axon Server to start a persistent stream connection.voidtriggerReconnect()Close this stream and signal downstream consumer that the stream is closed "erroneously" in order to trigger reconnect mechanisms.
-
-
-
Constructor Detail
-
PersistentStreamImpl
public PersistentStreamImpl(ClientIdentification clientId, String streamId, int bufferSize, int refillBatch, PersistentStreamCallbacks callbacks)
Constructs aPersistentStreamImpl.- Parameters:
clientId- the identification of the clientstreamId- the identifier for the persistent streambufferSize- the number of events to buffer locallyrefillBatch- the number of events to be consumed prior to refilling the buffercallbacks- the callbacks that are invoked on persistent stream events
-
-
Method Detail
-
openConnection
public void openConnection()
Sends an open request to Axon Server to start a persistent stream connection. The connection is closed with an error if the persistent stream does not exist.
-
openConnection
public void openConnection(InitializationProperties initializationProperties)
Sends an open request to Axon Server to start a persistent stream connection. IfinitializationPropertiesare provided these are added to the request to create the persistent stream if it does not exist.- Parameters:
initializationProperties- optional properties to create the persistent stream
-
triggerReconnect
public void triggerReconnect()
Close this stream and signal downstream consumer that the stream is closed "erroneously" in order to trigger reconnect mechanisms. This is to ensure that consumers of this stream can distinguish between regularly closed streams, and those closed with the intent to re-establish a connection.
-
close
public void close()
Description copied from interface:PersistentStreamCloses the persistent stream.- Specified by:
closein interfacePersistentStream
-
beforeStart
public void beforeStart(io.grpc.stub.ClientCallStreamObserver<StreamRequest> clientCallStreamObserver)
- Specified by:
beforeStartin interfaceio.grpc.stub.ClientResponseObserver<StreamRequest,StreamSignal>
-
onNext
public void onNext(StreamSignal streamSignal)
- Specified by:
onNextin interfaceio.grpc.stub.StreamObserver<StreamSignal>
-
onError
public void onError(Throwable throwable)
- Specified by:
onErrorin interfaceio.grpc.stub.StreamObserver<StreamSignal>
-
onCompleted
public void onCompleted()
- Specified by:
onCompletedin interfaceio.grpc.stub.StreamObserver<StreamSignal>
-
-