Skip to content

Instantly share code, notes, and snippets.

@assiotis
assiotis / ServerCalls.scala
Created January 1, 2018 00:19
An example of how to translate between gRPC and akka streams server-side using the reactive-grpc project
import java.util.concurrent.ExecutorService
import akka.stream.Materializer
import akka.stream.scaladsl.{Flow, Sink, Source}
import com.salesforce.reactivegrpccommon.{ReactivePublisherBackpressureOnReadyHandler, ReactiveStreamObserverPublisher}
import io.grpc.internal.{GrpcUtil, SerializingExecutor}
import io.grpc.stub.{CallStreamObserver, ServerCallStreamObserver, StreamObserver}
import io.grpc.{Status, StatusException, StatusRuntimeException}
import scala.concurrent.ExecutionContext