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
APubSubMessageSerDes
implementation that uses JacksonObjectMapper
to 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.Object
deserialize(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.String
supportedType()
-
-
-
Method Detail
-
deserialize
public java.lang.Object deserialize(byte[] data, io.micronaut.core.type.Argument<?> type)
Description copied from interface:PubSubMessageSerDes
Deserializes data into a target type.- Specified by:
deserialize
in 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:PubSubMessageSerDes
Serializes the message.- Specified by:
serialize
in interfacePubSubMessageSerDes
- Parameters:
data
- data to serialize- Returns:
- byte array of serialized data
-
supportedType
public java.lang.String supportedType()
- Specified by:
supportedType
in interfacePubSubMessageSerDes
- Returns:
- The supported mime type this SerDes is capable of hanlding
-
-