Package io.micronaut.gcp.pubsub.serdes
Class JsonPubSubMessageSerDes
- java.lang.Object
-
- io.micronaut.gcp.pubsub.serdes.JsonPubSubMessageSerDes
-
- All Implemented Interfaces:
PubSubMessageSerDes
@Singleton public class JsonPubSubMessageSerDes extends java.lang.Object implements PubSubMessageSerDes
APubSubMessageSerDesimplementation that uses JacksonObjectMapperto convert application/json mime types.- Since:
- 2.0.0
- Author:
- Vinicius Carvalho
-
-
Constructor Summary
Constructors Constructor Description JsonPubSubMessageSerDes(com.fasterxml.jackson.databind.ObjectMapper mapper)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectdeserialize(byte[] data, io.micronaut.core.type.Argument<?> type)Deserializes data into a target type.byte[]serialize(java.lang.Object data)Serializes the message.java.lang.StringsupportedType()
-
-
-
Method Detail
-
deserialize
public java.lang.Object deserialize(byte[] data, io.micronaut.core.type.Argument<?> type)Description copied from interface:PubSubMessageSerDesDeserializes data into a target type.- Specified by:
deserializein interfacePubSubMessageSerDes- Parameters:
data- byte data to deserializetype- target type- Returns:
- the deserialized java type
-
serialize
public byte[] serialize(java.lang.Object data)
Description copied from interface:PubSubMessageSerDesSerializes the message.- Specified by:
serializein interfacePubSubMessageSerDes- Parameters:
data- data to serialize- Returns:
- byte array of serialized data
-
supportedType
public java.lang.String supportedType()
- Specified by:
supportedTypein interfacePubSubMessageSerDes- Returns:
- The supported mime type this SerDes is capable of hanlding
-
-