Class PersistentStreamImpl

    • Constructor Detail

      • PersistentStreamImpl

        public PersistentStreamImpl​(ClientIdentification clientId,
                                    String streamId,
                                    int bufferSize,
                                    int refillBatch,
                                    PersistentStreamCallbacks callbacks)
        Constructs a PersistentStreamImpl.
        Parameters:
        clientId - the identification of the client
        streamId - the identifier for the persistent stream
        bufferSize - the number of events to buffer locally
        refillBatch - the number of events to be consumed prior to refilling the buffer
        callbacks - 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. If initializationProperties are 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.
      • beforeStart

        public void beforeStart​(io.grpc.stub.ClientCallStreamObserver<StreamRequest> clientCallStreamObserver)
        Specified by:
        beforeStart in interface io.grpc.stub.ClientResponseObserver<StreamRequest,​StreamSignal>
      • onNext

        public void onNext​(StreamSignal streamSignal)
        Specified by:
        onNext in interface io.grpc.stub.StreamObserver<StreamSignal>
      • onError

        public void onError​(Throwable throwable)
        Specified by:
        onError in interface io.grpc.stub.StreamObserver<StreamSignal>
      • onCompleted

        public void onCompleted()
        Specified by:
        onCompleted in interface io.grpc.stub.StreamObserver<StreamSignal>