Search in sources :

Example 1 with StreamEventListener

use of com.navercorp.pinpoint.profiler.sender.grpc.StreamEventListener in project pinpoint by naver.

the class SpanClientMock method newSpanStream.

private StreamObserver<PSpanMessage> newSpanStream() {
    System.out.println("### ");
    System.out.println("NEW SpanStream");
    System.out.println("###");
    StreamId spanId = StreamId.newStreamId("SpanStream");
    StreamEventListener<PSpanMessage> listener = new StreamEventListener<PSpanMessage>() {

        @Override
        public void start(ClientCallStreamObserver<PSpanMessage> requestStream) {
            spanStreamReconnector.reset();
        }

        @Override
        public void onError(Throwable t) {
            spanStreamReconnector.reconnect();
        }

        @Override
        public void onCompleted() {
            spanStreamReconnector.reconnect();
        }
    };
    ResponseStreamObserver<PSpanMessage, Empty> responseStreamObserver = new ResponseStreamObserver<PSpanMessage, Empty>(listener);
    return spanStub.sendSpan(responseStreamObserver);
}
Also used : StreamId(com.navercorp.pinpoint.profiler.sender.grpc.StreamId) Empty(com.google.protobuf.Empty) PSpanMessage(com.navercorp.pinpoint.grpc.trace.PSpanMessage) ClientCallStreamObserver(io.grpc.stub.ClientCallStreamObserver) ResponseStreamObserver(com.navercorp.pinpoint.profiler.sender.grpc.ResponseStreamObserver) StreamEventListener(com.navercorp.pinpoint.profiler.sender.grpc.StreamEventListener)

Aggregations

Empty (com.google.protobuf.Empty)1 PSpanMessage (com.navercorp.pinpoint.grpc.trace.PSpanMessage)1 ResponseStreamObserver (com.navercorp.pinpoint.profiler.sender.grpc.ResponseStreamObserver)1 StreamEventListener (com.navercorp.pinpoint.profiler.sender.grpc.StreamEventListener)1 StreamId (com.navercorp.pinpoint.profiler.sender.grpc.StreamId)1 ClientCallStreamObserver (io.grpc.stub.ClientCallStreamObserver)1