Reputation: 15103
I have an already existing application in scala which uses akka-remote to send messages from webserver to appserver. I am going to change this to http requests instead.
I see that today akka-remote already handles all the serialization and deserialization for me without writing any serializers / deserializers, but the protocol is protocol-buffer.
With the http request-response I would like to have json instead of protocol-buffer.
The messages sent from webserver to appserver are complex case classes. I don't want to write all the writer/reader/formatters to do the json serialization, just as there was no need to write protocol buffer serialization with akka remote.
Is there any solution that will enable me to do json serialization without writing all the writer/readers?
Thanks
Upvotes: 0
Views: 201
Reputation: 4515
Use circe JSON library. Other libraries like play json, spray json and others require you explicitly specify formatters for every case class. Another approach is to use Avro serialization with schema-registry. It wraps json with some additional information so it's also readable. This approach requires some routine to make it up and running, but it protects you against backward incompatible changes.
Upvotes: 0