Following this blog related to consuming gRPC services in quarkus https://quarkus.io/guides/grpc-service-consumption
Successfully generated code from proto files provided by api provider by running 'mvn compile'.
But got the error when trying to build the app
“only Mutiny service interfaces, blocking stubs, reactive stubs based on Mutiny and io.grpc.Channel can be injected via @GrpcClient”
./mvnw clean package -Dmaven.test.skip
...
[error]: Build step io.quarkus.grpc.deployment.GrpcClientProcessor#discoverInjectedGrpcServices threw an exception: javax.enterprise.inject.spi.DeploymentException: ...ServiceGrpc cannot be injected into ...ServiceGrpc - only Mutiny service interfaces, blocking stubs, reactive stubs based on Mutiny and io.grpc.Channel can be injected via @GrpcClient
[ERROR] at io.quarkus.grpc.deployment.GrpcClientProcessor.invalidInjectionPoint(GrpcClientProcessor.java:282)
[ERROR] at io.quarkus.grpc.deployment.GrpcClientProcessor.discoverInjectedGrpcServices(GrpcClientProcessor.java:170)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[ERROR] at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR] at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:833)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Fixed the issue with the build by changing the injection , please see my code below. But still not able to get it working fully , please see details in the comments as well:
application.properties
has also the varquarkus.grpc.clients.msg-service.host
with the same value asUtils.getChannelUrlStr()
.