Questions tagged [protobuf-java]
289 questions
13
votes
1 answer
Convert json to dynamically generated protobuf in Java
Given the following json response:
{
"id" : "123456",
"name" : "John Doe",
"email" : "john.doe@example.com"
}
And the following user.proto file:
message User {
string id = 1;
string name = 2;
string email = 3;
}
I would…

Alin Stoian
- 1,122
- 1
- 12
- 24
11
votes
1 answer
Missing bounds checking elimination in String constructor?
Looking into UTF8 decoding performance, I noticed the performance of protobuf's UnsafeProcessor::decodeUtf8 is better than String(byte[] bytes, int offset, int length, Charset charset) for the following non ascii string: "Quizdeltagerne spiste…

Amir Hadadi
- 421
- 4
- 13
11
votes
3 answers
dial tcp 127.0.0.1:9091: connect: connection refused
I am using gRPC application and building a simple app. Below the files.
syntax = "proto3";
option java_multiple_files = true;
package com.grpc;
message HelloRequest {
string firstName = 1;
string lastname = 2;
}
message HelloResponse {
…

Sherlocker
- 185
- 1
- 1
- 12
11
votes
2 answers
Does removing existing field from protobuf message cause issues?
I am having one protobuf message -
message Sample{
string field1 = 1;
string field2 = 2;
string field3 = 3;
}
These messages are stored in datastore in binary format.
So if I want to remove any of the defined field in the above message…

Rahul Vedpathak
- 1,346
- 3
- 16
- 30
9
votes
1 answer
Batching technique using Protobufs
Is there an efficient technique to batch different Protobuf events while sending over HTTP?
The goal is to have a list of multi-type Protobuf messages in one request. One idea I have is to separate messages in small arrays and specify their type to…

gorros
- 1,411
- 1
- 18
- 29
9
votes
4 answers
Protocol Buffers: How to parse a .proto file in Java
I am trying to dynamically parse a given .proto file in Java to decode a Protobuf-encoded binary.
I have the following parsing method, in which the "proto" string contains the content of the .proto file:
public static Descriptors.FileDescriptor…

WSH
- 331
- 1
- 2
- 10
8
votes
1 answer
Resolve Firebase InApp Messasing and Dialogflow dependencies
I have a project where I am using both FirebaseInAppMessaging and Dialogflow but I am having a hard time resolving the dependencies. After adding both FirebaseInAppMessaging and Dialogflow, I get the following error:
Duplicate class…

Razor
- 143
- 2
- 8
8
votes
1 answer
--grpc_out: protoc-gen-grpc: Plugin failed with status code 1 on osx. (Java)
I am following a tutorial about using grpc and I am supposed to use a plugin to generate source code but I am stuck on how to use the --grpc_out and --plugin flag.
Below are the current challenges.
The protocol generator downloaded from…

IsaacK
- 1,178
- 1
- 19
- 49
7
votes
1 answer
How to deal with unknown protobuf fields in Java?
I have a Java application that reads some protobuf data from another computer and can then modify some values and write it back. It is very likely that a user could read the data using an outdated .proto file, so there would be some fields it…

Mike Foss
- 311
- 2
- 6
7
votes
1 answer
Map List with Mapstruct from Java POJO to Protobuf (proto3)
I'm trying to map some POJOs from Java to Protobuf (proto3). Some of them contain Lists. While mapping lists with POJOs (for example List) is no problem, I'm getting a UnsupportedOperationException.
Example with List (this works…

Liso
- 195
- 5
- 15
6
votes
2 answers
Proto datastore jetpack compose - gradle dependencies exception
I followed this codelab from the android developer platform: https://developer.android.com/codelabs/android-proto-datastore#4
Added the same exact dependencies as shown in the codelab and I get the following gradle exception when trying to sync
A…

Giuliopime
- 707
- 4
- 21
6
votes
1 answer
Should i convert gRPC protobuf message to DTO? - Best Practice
Lately, I started using gRPC messages to interact with microservices. Until now I was using the REST API's with DTOs do keep on decoupling and encapsulation in the code itself.
Now I'm while using the gRPC protobuf msgs, I started wondering what…

USer22999299
- 5,284
- 9
- 46
- 78
6
votes
2 answers
protoc command not generating all base classes (java)
I have been trying to generate the basic gRPC client and server interfaces from a .proto service definition here from the grpc official repo.
The relevant service defined in that file (from the link above) is below:
service RouteGuide {
rpc…

shafeen
- 2,431
- 18
- 23
6
votes
0 answers
Custom printers for protobuf in Java
Im using protobuf 2.6.1 and I have a case where there are complex types such as UUID represented as two fixed64 fields, timestamps represented as longs etc which need to be printed in a more human readable way.
Im looking for extending the toString…

aks
- 61
- 2
5
votes
1 answer
Issue on R8 minify
I installed the new version of Android Studio and did update of my project (without changing dependencies) and i had this issue:
Missing class…

JpA
- 51
- 2