Search in sources :

Example 1 with BlockingGrpcPubSubSubscriber

use of org.apache.flink.streaming.connectors.gcp.pubsub.BlockingGrpcPubSubSubscriber in project flink by apache.

the class PubSubSubscriberFactoryForEmulator method getSubscriber.

@Override
public PubSubSubscriber getSubscriber(Credentials credentials) throws IOException {
    ManagedChannel managedChannel = NettyChannelBuilder.forTarget(hostAndPort).usePlaintext().build();
    PullRequest pullRequest = PullRequest.newBuilder().setMaxMessages(maxMessagesPerPull).setSubscription(projectSubscriptionName).build();
    SubscriberGrpc.SubscriberBlockingStub stub = SubscriberGrpc.newBlockingStub(managedChannel);
    return new BlockingGrpcPubSubSubscriber(projectSubscriptionName, managedChannel, stub, pullRequest, retries, timeout);
}
Also used : BlockingGrpcPubSubSubscriber(org.apache.flink.streaming.connectors.gcp.pubsub.BlockingGrpcPubSubSubscriber) PullRequest(com.google.pubsub.v1.PullRequest) ManagedChannel(io.grpc.ManagedChannel) SubscriberGrpc(com.google.pubsub.v1.SubscriberGrpc)

Aggregations

PullRequest (com.google.pubsub.v1.PullRequest)1 SubscriberGrpc (com.google.pubsub.v1.SubscriberGrpc)1 ManagedChannel (io.grpc.ManagedChannel)1 BlockingGrpcPubSubSubscriber (org.apache.flink.streaming.connectors.gcp.pubsub.BlockingGrpcPubSubSubscriber)1