Closed
Description
For example I have a local Karaf instance on which I deployed the health service example (following the guide on https://github.com/ECF/grpc-RemoteServicesProvider):
karaf@root()> feature:list -i
Name | Version | Required | State | Repository | Description
--------------------------------------+---------+----------+---------+--------------------------------+--------------------------------------------------
...
ecf-rs-examples-grpc-healthcheck-api | 1.3.2 | | Started | ecf-remoteservices-grpc-1.3.2 | ECF Remote Services Grpc HealthCheck Example Serv
ecf-rs-examples-grpc-healthcheck-impl | 1.3.2 | x | Started | ecf-remoteservices-grpc-1.3.2 | ECF Remote Services Grpc HealthCheck Example Serv
...
I then tried to consume the health check service using plain grpc-java. My consumer/client code looks as follows:
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.health.v1.HealthCheckRequest;
import io.grpc.health.v1.HealthCheckResponse;
import io.grpc.health.v1.HealthGrpc;
public class Main {
public static void main(String[] args) {
System.out.println("Hello I am a gRPC client");
ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 50002)
.usePlaintext()
.build();
HealthGrpc.HealthBlockingStub client = HealthGrpc.newBlockingStub(channel);
final HealthCheckResponse check = client.check(HealthCheckRequest.newBuilder()
.build());
System.out.println(check.getStatus());
channel.shutdown();
}
}
which leads to the following output:
Hello I am a gRPC client
Exception in thread "main" io.grpc.StatusRuntimeException: UNIMPLEMENTED: Method not found: grpc.health.v1.Health/Check
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:262)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:243)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:156)
at io.grpc.health.v1.HealthGrpc$HealthBlockingStub.check(HealthGrpc.java:251)
at grpc.java.course.client.Main.main(Main.java:19)
PS: If it's possible to consume OSGi/gRPC remote services outside the OSGi ecosystem, is it possible to activate gRPC server reflection on a Karaf instance? E.g. to get an overview of all gRPC services the Karaf instance provides?
(Btw thanks for that awesome feature. It would be awesome if you can reuse your OSGi services from plain java, e.g. by deploying them on Karaf and consuming them using grpc-java.)
Metadata
Metadata
Assignees
Labels
No labels