SpinGo / op-rabbit

The Opinionated RabbitMQ Library for Scala and Akka
Other
232 stars 73 forks source link

Improve circe encoder #168

Open aaabramov opened 5 years ago

aaabramov commented 5 years ago

According to https://github.com/circe/circe/issues/536 there is no need to make transitive string serialization to get UTF-8 bytes array.

timcharper commented 5 years ago

Can you open a PR or put some more details about what you mean?

aaabramov commented 5 years ago

Sure, sorry.

Currently, op-rabbit-circe serializes JSON to string, and then gets bytes from it (https://github.com/SpinGo/op-rabbit/blob/master/addons/circe/src/main/scala/com/spingo/op_rabbit/CirceSupport.scala#L18):

value.asJson.noSpaces.getBytes(utf8)

But circe is able to generate bytes array directly.

Examples can be found here: https://github.com/circe/circe-jackson/pull/11/files