Example project for Spring Boot RSocket with Protocol Buffer
-
RSocket client-server.
-
Endpoint
/api/person
→ json endpoint with simple pojo. -
Endpoint
/api/proto-json/person
→ protobuf object as a json endpoint(Not working). -
Endpoint
/api/proto/person
→ protobuf object endpoint. -
Endpoint
/api/rsoc/person
→ rsocket client-server endpoint with protobuf mime type. -
Ports
-
person service →
8080
-
person service rsocket →
9080
-
person client service →
8081
-
person client service rsocket →
9081
-
-
Performance of the varies endpoint/communication modes can be compared using actuator endpoint
/actuator/prometheus
ofperson-client-service
-
Download rsc.jar, a rsocket cli client.
-
Now execute below command to retrieve
json
data.java -jar rsc-0.4.2.jar tcp://localhost:9080 \ -r io.github.kprasad99.json.person \ --stream
Though the data is too less you can add the data to database before running the applicaiton.
-
Start the applications, prometheus and grafana.
$ docker-compose -f docker-compose-dev.yml up -d
Noteopenjdk
docker image is a custom image, you might need to change to any availablejdk-11
one. -
Once the application is started open Grafana UI at
http://localhost:30072
NoteDefault username/password is admin/admin
-
Open postman and import collection
postman/spring-rsocket-protobuf.postman_collection.json
. -
Now use the runner tool to run the collection with N-number of requests.