@Singleton public class JsonRabbitMessageSerDes extends java.lang.Object implements RabbitMessageSerDes<java.lang.Object>
Modifier and Type | Field and Description |
---|---|
static java.lang.Integer |
ORDER
The order of this serDes.
|
Constructor and Description |
---|
JsonRabbitMessageSerDes(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
deserialize(RabbitConsumerState messageState,
io.micronaut.core.type.Argument<java.lang.Object> type)
Deserializes the message into the requested type.
|
int |
getOrder() |
byte[] |
serialize(java.lang.Object data,
MutableBasicProperties basicProperties)
Serializes the data into a byte[] to be published
to RabbitMQ.
|
boolean |
supports(io.micronaut.core.type.Argument<java.lang.Object> argument)
Determines if this serdes supports the given type.
|
public JsonRabbitMessageSerDes(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
objectMapper
- The jackson object mapperpublic java.lang.Object deserialize(RabbitConsumerState messageState, io.micronaut.core.type.Argument<java.lang.Object> type)
RabbitMessageSerDes
deserialize
in interface RabbitMessageSerDes<java.lang.Object>
messageState
- The message to deserializetype
- The type to be returnedpublic byte[] serialize(java.lang.Object data, MutableBasicProperties basicProperties)
RabbitMessageSerDes
serialize
in interface RabbitMessageSerDes<java.lang.Object>
data
- The data to serializebasicProperties
- The properties of the messagepublic int getOrder()
getOrder
in interface io.micronaut.core.order.Ordered
public boolean supports(io.micronaut.core.type.Argument<java.lang.Object> argument)
RabbitMessageSerDes
supports
in interface RabbitMessageSerDes<java.lang.Object>
argument
- The type