Quarkus GRPC server doesn't start

1k Views Asked by At

I'm trying to use GRPC with Quarkus, following the guide (edit: I'm using version 1.13.7.Final so using the slightly older guide as @GrpcService was changed in v2) I've got the io.quarkus:quarkus-grpc dependency in my pom, I'm able to write a proto file and generate the java classes. I've then extended the implementation base (see below). But on starting the application there's no server started on the default port of 9000, and in the logs there are no errors, the only mention of my service is Remove unused class bean and the class name.

This is what my implemenation class looks like (excluded the imports):

@Singleton
public class HelloService extends MutinyGreeterGrpc.GreeterImplBase {
  @Override
  public Uni<HelloReply> sayHello(HelloRequest request) {
    return Uni.createFrom().item(() -> HelloReply.newBuilder().setName(request.getName()).build());
  }
}

Anything glaringly obvious I might be missing?

Additional attempt:

I've checked out the quarkusio/quarkus-quickstarts from github, changed to the 1.13.7.Final tag, and just run mvn clean compile quarkus:dev, I'm getting the following error (roughly):

javax.enterprise.inject.spi.DeploymentException: Found 2 deployment problems:
[1] Unsatisfied dependency for type examples.GteeterGrpc$GreeterBlockingStub and qualifiers [@Default]
  - java member: io.quarkus.grpc.examples.hello.HelloWorldEnpoint#blockingHelloService
  - declared on CLASS bean [types=[io.quarkus.grpc.examples.hello.HelloWorldEnpoing, java.lang.Object]. qualifiers=[@Default, @Any], target=io.quarkus.grpc.examples.hello.HelloWorldEnpoint]

This is on Ubuntu 20.04 running openjdk 11.0.11

1

There are 1 best solutions below

3
On

I'm guessing you are using a newer version of Quarkus than 1.11 and using the guide for 1.11 (this is what you linked).

In recent Quarkus versions, an implementation of a gRPC service has to be annotated with @GrpcService (instead of @Singleton - how it used to be before). So your class should probably look like this:

@GrpcService
public class HelloService extends MutinyGreeterGrpc.GreeterImplBase {
  @Override
  public Uni<HelloReply> sayHello(HelloRequest request) {
    return Uni.createFrom().item(() -> HelloReply.newBuilder().setName(request.getName()).build());
  }
}

The current version of the guide: https://quarkus.io/guides/grpc-service-implementation