question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RSocket Protoc 0.2.19 generates invalid protobuf code for rsocket-java 1.0.1

See original GitHub issue

Expected Behavior

When running the generateProto task using the latest version of io.rsocket.rpc:rsocket-rpc-core/io.rsocket.rpc:rsocket-rpc-protobuf (0.2.19) and the latest version of io.rsocket:rsocket-core (1.0.1), the generated code can be compiled without any issues.

Actual Behavior

When running the generateProto task using the latest version of io.rsocket.rpc:rsocket-rpc-core/io.rsocket.rpc:rsocket-rpc-protobuf (0.2.19) and the latest version of io.rsocket:rsocket-core (1.0.1), I get an error inside generated-sources/main/rsocketRpc/com/rsocket/rpc/Blocking...Service.java:

Cannot resolve symbol 'SwitchTransformFlux'

This is because of the following snippet:

  @java.lang.Override
  public reactor.core.publisher.Flux<io.rsocket.Payload> requestChannel(org.reactivestreams.Publisher<io.rsocket.Payload> payloads) {
    return new io.rsocket.internal.SwitchTransformFlux<io.rsocket.Payload, io.rsocket.Payload>(payloads, new java.util.function.BiFunction<io.rsocket.Payload, reactor.core.publisher.Flux<io.rsocket.Payload>, org.reactivestreams.Publisher<? extends io.rsocket.Payload>>() {
      @java.lang.Override
      public org.reactivestreams.Publisher<io.rsocket.Payload> apply(io.rsocket.Payload payload, reactor.core.publisher.Flux<io.rsocket.Payload> publisher) {
        return requestChannel(payload, publisher);
      }
    });
  }

It seems to me like the SwitchTransformFlux class got removed/replaced in version 1.0.0 of rsocket-java. When I downgrade to 0.12.1, the error is gone. None the less, this is an issue as a lot of dependencies (e.g. the spring boot rsocket starter lib) already use v1.X and therefore cannot produce valid code.

Steps to Reproduce

  1. Import io.rsocket:rsocket-core:1.0.1
  2. Import io.rsocket.rpc:rsocket-rpc-core:0.2.19
  3. Import io.rsocket.rpc:rsocket-rpc-protobuf:0.2.19
  4. Create a .proto file with a service that uses a channel
service SomeService {
  rpc channel(stream SomeRequest) returns (stream SomeResponse) {}
}
  1. Generate the protobuf classes (e.g. ./gradlew generateProto)
  2. Try to compile the blocking server implementation (generated-sources/main/rsocketRpc/com/rsocket/rpc/BlockingSomeServiceServer.java)

Should fail with the exception mentioned above.

Possible Solution

Either reintroduce SwitchTransformFlux or change the rsocket protoc to not use it anymore.

Your Environment

  • io.rsocket:rsocket-core:1.0.1
  • io.rsocket.rpc:rsocket-rpc-core:0.2.19
  • io.rsocket.rpc:rsocket-rpc-protobuf:0.2.19
  • com.google.protobuf:protoc:3.12.1
  • com.google.protobuf:protobuf-java:3.12.1

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
eksdcommented, Sep 28, 2020

@OlegDokuka , hi, is it possible to make a fix of this bug in the nearest future? Our work depends a lot on rsocket and we cannot upgrade it without this fix. Thanks.

1reaction
OlegDokukacommented, Sep 28, 2020

@eksd I will take a look at that today.

Cheers, Oleh

Read more comments on GitHub >

github_iconTop Results From Across the Web

RSocket RPC (Windows) Binaries with Gradle (Bluild fail)
Searching for a solution to this problem myself I have found the answer. In short it looks like currently there are no windows...
Read more >
Overview | Protocol Buffers - Google Developers
Protocol buffers can be extended with new information without invalidating existing data or requiring code to be updated. Protocol buffers are ...
Read more >
Intro to gRPC and Protocol Buffers | by Trevor Kendrick
Protobuf messages are defined in .proto files. Protocol buffers has a compilation tool called protoc that can compile your code in many ...
Read more >
How to use Protobuf for data interchange - Opensource.com
Protocol buffers (Protobufs), like XML and JSON, allow applications, ... void echo( ... Here are the essentials from the generated code:.
Read more >
RSocket RPC - Java - Coder Social Home
standard rsocket rpc java implementation from coder social. ... RSocket Protoc 0.2.19 generates invalid protobuf code for rsocket-java 1.0.1 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found