Package io.micronaut.rabbitmq.serdes
Class JsonRabbitMessageSerDes
java.lang.Object
io.micronaut.rabbitmq.serdes.JsonRabbitMessageSerDes
- All Implemented Interfaces:
 io.micronaut.core.order.Ordered,RabbitMessageSerDes<Object>
@Requires(bean=io.micronaut.json.JsonMapper.class)
@Singleton
public class JsonRabbitMessageSerDes
extends Object
implements RabbitMessageSerDes<Object>
Serializes and deserializes objects as JSON using Jackson.
- Since:
 - 1.1.0
 - Author:
 - James Kleeh
 
- 
Field Summary
FieldsFields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE - 
Constructor Summary
ConstructorsConstructorDescriptionJsonRabbitMessageSerDes(io.micronaut.json.JsonMapper jsonMapper) Default constructor. - 
Method Summary
Modifier and TypeMethodDescriptiondeserialize(RabbitConsumerState messageState, io.micronaut.core.type.Argument<Object> type) Deserializes the message into the requested type.intgetOrder()byte[]serialize(Object data, MutableBasicProperties basicProperties) Serializes the data into a byte[] to be published to RabbitMQ.booleanDetermines if this serdes supports the given type. 
- 
Field Details
- 
ORDER
The order of this serDes. 
 - 
 - 
Constructor Details
- 
JsonRabbitMessageSerDes
public JsonRabbitMessageSerDes(io.micronaut.json.JsonMapper jsonMapper) Default constructor.- Parameters:
 jsonMapper- The json mapper- Since:
 - 3.2.0
 
 
 - 
 - 
Method Details
- 
deserialize
public Object deserialize(RabbitConsumerState messageState, io.micronaut.core.type.Argument<Object> type) Description copied from interface:RabbitMessageSerDesDeserializes the message into the requested type.- Specified by:
 deserializein interfaceRabbitMessageSerDes<Object>- Parameters:
 messageState- The message to deserializetype- The type to be returned- Returns:
 - The deserialized body
 
 - 
serialize
Description copied from interface:RabbitMessageSerDesSerializes the data into a byte[] to be published to RabbitMQ.- Specified by:
 serializein interfaceRabbitMessageSerDes<Object>- Parameters:
 data- The data to serializebasicProperties- The properties of the message- Returns:
 - The message body
 
 - 
getOrder
public int getOrder()- Specified by:
 getOrderin interfaceio.micronaut.core.order.Ordered
 - 
supports
Description copied from interface:RabbitMessageSerDesDetermines if this serdes supports the given type.- Specified by:
 supportsin interfaceRabbitMessageSerDes<Object>- Parameters:
 argument- The type- Returns:
 - True if the type is supported
 
 
 -