Skip to content
Advertisement

How to access gRPC server in matlab?

We have moved our DataAccess logic to Microservice and it is currently implemented as gRPC with C++ and we are able to utilize that in C# client and C++ client.

Now we have to make use of this DataAccess grpc in Matlab client(legacy). So, i’m trying to find a way to access gRPC from Matlab and found that there is no official support for this.

I found two solutions,

Using Java

I have tried as suggested in this thread. i have created a sample grpc client java using Eclipse. but when i try to access that class/methods from matlab, i’m facing below issue,

    Java exception occurred:
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;CLjava/lang/Object;)V
        at io.grpc.Metadata$Key.validateName(Metadata.java:630)
        at io.grpc.Metadata$Key.<init>(Metadata.java:638)
        at io.grpc.Metadata$Key.<init>(Metadata.java:568)
        at io.grpc.Metadata$AsciiKey.<init>(Metadata.java:743)
        at io.grpc.Metadata$AsciiKey.<init>(Metadata.java:738)
        at io.grpc.Metadata$Key.of(Metadata.java:594)
        at io.grpc.Metadata$Key.of(Metadata.java:590)
        at io.grpc.internal.GrpcUtil.<clinit>(GrpcUtil.java:84)
        at io.grpc.internal.AbstractManagedChannelImplBuilder.<clinit>(AbstractManagedChannelImplBuilder.java:83)
        at io.grpc.netty.NettyChannelProvider.builderForAddress(NettyChannelProvider.java:37)
        at io.grpc.netty.NettyChannelProvider.builderForAddress(NettyChannelProvider.java:23)
        at io.grpc.ManagedChannelBuilder.forAddress(ManagedChannelBuilder.java:37)

it was discussed here,and it says it is not possible anymore. Can anyone let me know whether this is possible now or i am missing something?

Using Matlab Proto Compiler [Farsounder]

Next i have tried to use Farsounder solution v2.5.0 for creating stub files based on this. Only after creating protoc.exe, I realized it was for Proto V2. So, now i’m trying use Protov3Matlab.

But the build instructions are not clear here and it has one cmake file and i dont know how to run it. Can anyone help me build this for windows environment?

I’m new to Java and Matlab, sorry if i have missed any obvious things.

Thanks in advance.

Advertisement

Answer

I was able to create protoc.exe. Steps:

  1. Checked out latest protobuf source.
  2. Updated the source with farsounder matlab source and cmake file.
  3. Followed https://github.com/protocolbuffers/protobuf/blob/master/cmake/README.md build the source.
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement