use of com.quancheng.saluki.core.grpc.exception.RpcBizException in project tesla by linking12.
the class ProtobufUtil method findDirectyprotobuf.
private static Pair<Descriptor, Descriptor> findDirectyprotobuf(final FilterRpcDO rpcDo) {
byte[] protoContent = rpcDo.getProtoContext();
FileDescriptorSet descriptorSet = null;
if (protoContent != null && protoContent.length > 0) {
try {
descriptorSet = FileDescriptorSet.parseFrom(protoContent);
ServiceResolver serviceResolver = ServiceResolver.fromFileDescriptorSet(descriptorSet);
ProtoMethodName protoMethodName = ProtoMethodName.parseFullGrpcMethodName(rpcDo.getServiceName() + "/" + rpcDo.getMethodName());
MethodDescriptor protoMethodDesc = serviceResolver.resolveServiceMethod(protoMethodName);
return new ImmutablePair<Descriptor, Descriptor>(protoMethodDesc.getInputType(), protoMethodDesc.getOutputType());
} catch (InvalidProtocolBufferException e) {
LOG.error(e.getMessage(), e);
throw new RpcBizException("protobuf service definition is invalid,the descriptorSet is: " + descriptorSet, e);
}
}
return null;
}
Aggregations