GRPC

Scio supports lookups via GRPC in the scio-grpc artifact.

Given an SCollection of GRPC request objects (ConcatRequest below), grpcLookup (or grpcLookupStream for iterable responses, grpcBatchLookup for batched calls) provides a concise syntax for handling responses:

import com.spotify.scio._
import com.spotify.scio.values.SCollection
import com.spotify.scio.grpc._
import com.spotify.concat.v1._
import io.grpc.netty.NettyChannelBuilder

val ServiceUri: String = "dns://localhost:50051"
val maxPendingRequests = 10
val requests: SCollection[ConcatRequest] = ???
requests
  .grpcLookup[ConcatResponse, ConcatServiceGrpc.ConcatServiceFutureStub](
    () => NettyChannelBuilder.forTarget(ServiceUri).usePlaintext().build(),
    ConcatServiceGrpc.newFutureStub,
    maxPendingRequests
  )(_.concat)