Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/telkomdev/javaprotobufdemo

Protocol Buffer demo using Java
https://github.com/telkomdev/javaprotobufdemo

Last synced: about 5 hours ago
JSON representation

Protocol Buffer demo using Java

Awesome Lists containing this project

README

        

## Protocol Buffer demo using Java

## Getting started

- Install `Maven`
https://maven.apache.org/download.cgi

- Generate Proto Java from `.proto` file

Protobuf file look like this

```protobuf
syntax="proto3";

package product;

option java_package = "com.telkomdev.protodemo";
option java_outer_classname = "ProductProtos";

message Product {
string ID = 1;
string Name = 2;
uint64 Quantity = 3;
repeated string Images = 4;
}

message ProductList {
repeated Product Products = 1;
}
```

```shell
$ make gen
```

- Build `jar`
```shell
$ mvn clean package
```

- Run `jar`
```shell
$ java -jar target/JavaProtobufDemo-1.0-SNAPSHOT.jar
```