cbornet commented on a change in pull request #3032: Add gRPC proxy URL: https://github.com/apache/pulsar/pull/3032#discussion_r235540990
########## File path: pulsar-grpc/src/main/java/org/apache/pulsar/grpc/TestClient.java ########## @@ -0,0 +1,72 @@ +package org.apache.pulsar.grpc; + +import com.google.protobuf.ByteString; +import io.grpc.ManagedChannel; +import io.grpc.ManagedChannelBuilder; +import io.grpc.Metadata; +import io.grpc.stub.MetadataUtils; +import io.grpc.stub.StreamObserver; +import org.apache.pulsar.grpc.proto.ConsumerAck; +import org.apache.pulsar.grpc.proto.ConsumerMessage; +import org.apache.pulsar.grpc.proto.PulsarGrpc; +import org.slf4j.LoggerFactory; + +import java.util.concurrent.LinkedBlockingQueue; + +import static io.grpc.Metadata.ASCII_STRING_MARSHALLER; + +public class TestClient { + + public static void main(String[] args) throws Exception { + ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 50051) + .usePlaintext() + .build(); + + Metadata headers = new Metadata(); + headers.put(Metadata.Key.of("pulsar-topic", ASCII_STRING_MARSHALLER), "persistent://public/default/my-topic12"); + headers.put(Metadata.Key.of("pulsar-subscription", ASCII_STRING_MARSHALLER), "my-subscription"); + headers.put(Metadata.Key.of("pulsar-subscription-type", ASCII_STRING_MARSHALLER), "Shared"); + headers.put(Metadata.Key.of("pulsar-max-redeliver-count", ASCII_STRING_MARSHALLER), "3"); + headers.put(Metadata.Key.of("pulsar-ack-timeout-millis", ASCII_STRING_MARSHALLER), "2000"); + headers.put(Metadata.Key.of("pulsar-consumer-name", ASCII_STRING_MARSHALLER), "test"); + + PulsarGrpc.PulsarStub asyncStub = MetadataUtils.attachHeaders(PulsarGrpc.newStub(channel), headers); Review comment: Yes that's attached to every request done from this stub. In this test code (that I will remove eventually. or move elsewhere), I only do one request so it's no big deal. Note that only one request is done, and then the data is passed as streams. A bit like websockets. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services