GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - scala-steward/scalapb-reactor: ScalaPB gRPC generator for Project Reactor

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

67 Commits
67 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
code-gen/src/main/scala/scalapb/reactor
code-gen/src/main/scala/scalapb/reactor
 
 
e2e/src
e2e/src
 
 
examples
examples
 
 
project
project
 
 
.gitignore
.gitignore
 
 
.scalafmt.conf
.scalafmt.conf
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.sbt
build.sbt
 
 

Repository files navigation

ScalaPB-Reactor

Maven Central Build Status

The ScalaPB gRPC generator to run Reactive gRPC server and client on top Project Reactor's Scala extension.

Highlights

  • Uses Reactive gRPC for Java Runtime which provides Reactive Streams on top of gRPC's back-pressure support.
  • Uses Reactor Scala Extensions for easily building stream requests and responses.

Installation

Add the following configuration to project/plugins.sbt.

addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.4")
libraryDependencies += "kr.ikhoon.scalapb-reactor" %% "scalapb-reactor-codegen" % "<latest-version>"

Add the following configuration to build.sbt.

PB.targets in Compile := Seq(
  scalapb.gen() -> (sourceManaged in Compile).value,
  scalapb.reactor.ReactorCodeGenerator -> (sourceManaged in Compile).value
)

ScalaPB-Reactor 0.3.0 currently supports Scala 2.12 and 2.13. Please use 0.1.0 for Scala 2.11.

Example

ScalaPB-Reactor generates your stub file to <package>.<file-name>.Reactor<service-name>. The following proto file will be generated to com.example.test_service.ReactorTestService.

// file: test_service.proto

syntax = "proto3";

package com.example;

message Request {
    string in = 1;
}

message Response {
    string out = 1;
}

service TestService {
    rpc Unary(Request) returns (Response);
    rpc ServerStreaming(Request) returns (stream Response);
    rpc ClientStreaming(stream Request) returns (Response);
    rpc BidiStreaming(stream Request) returns (stream Response);
}

The generated gRPC stub for Reactor contains the following structure.

object ReactorTestServiceGrpc {
  // Implement this trait for your service.
  trait ReactorTestService {
    def unary(request: Request): SMono[Response]
    def serverStreaming(request: Request): SFlux[Response]
    def clientStreaming(request: SFlux[Request]): SMono[Response]
    def bidiStreaming(request: SFlux[Request]): SFlux[Response]
  }
  
  object ReactorTestService {
    // Use this method to bind your service with gRPC server
    def bindService(serviceImpl: ReactorTestService): ServerServiceDefinition = {
       ... 
    }
  }
  
  // You use this class for creating gRPC client stub.
  class ReactorTestServiceStub(channel: Channel, options: CallOptions) 
    extends AbstractStub[ReactorTestServiceStub](channel, options) with ReactorTestService {
  }
}

Visit examples to find a fully working example.

About

ScalaPB gRPC generator for Project Reactor

Resources

Readme
License

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.