Skip to content

Instantly share code, notes, and snippets.

View vyshane's full-sized avatar
💻
Coding

Vy-Shane Xie vyshane

💻
Coding
View GitHub Profile
import com.google.protobuf.Descriptors.{MethodDescriptor, ServiceDescriptor}
import com.trueaccord.scalapb.compiler.FunctionalPrinter.PrinterEndo
import com.trueaccord.scalapb.compiler._
import scala.collection.JavaConverters._
final class MonixGrpcPrinter(service: ServiceDescriptor,
override val params: GeneratorParams)
extends DescriptorPimps {
@jchapuis
jchapuis / MonixGrpcAdapters.scala
Last active July 28, 2017 05:33
Adapters to convert a grpc stream to a back-pressured observable (supporting back-pressure)
import io.grpc.stub.{ClientCallStreamObserver, ClientResponseObserver, StreamObserver}
import monix.execution.Ack.{Continue, Stop}
import monix.execution.{Cancelable, Scheduler}
import monix.reactive.observers.Subscriber
import monix.reactive.{Observable, Observer}
import scala.concurrent.{CancellationException}
import scala.util.{Failure, Success}
object MonixGrpcAdapters {