I am implementing a gprc server in quarkus (1.8.3.Final
).
My service is written in reactive style (smallrye mutiny)
This is my service class
@Singleton
@Blocking
@Slf4j
public class GrpcService extends MutinyGrpcServicesGrpc.GrpcServicesImplBase{
@Blocking
public Uni<MyResponse> executeMyLogic(MyRequest request) {
System.out.println("grpc thread name "+Thread.currentThread().getName());
...
}
}
Now the actual logic written inside executeMyLogic
is a bit blocking and was resulting in blocked event loop warnings(and some other errors) by vertx.
So as mentioned in the quarkus grpc server guide(https://quarkus.io/guides/grpc-getting-started)
I annotated the method with @Blocking (io.smallrye.common.annotation.Blocking)
.
Before I added this annotation I get this log on sys.out
grpc thread name vert.x-eventloop-thread-0
which indicates that this logic is being run on a vertx event loop which seems to be causing the issue.
Now according to my understanding after adding this @Blocking annotation on executeMyLogic
this should be running on some worker thread.
But its still running on vertx event loop.
It seems like this this annotation is not being honored by the framework.
Correct me if my understanding is wrong or else please help me get this working.
So as it turns out this was a bug in quarkus framework.
Earlier it didn't honor the @Blocking annotation.
It worked after upgrading to 1.10.2.Final