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