Package io.micronaut.gcp.pubsub.serdes
Class JsonPubSubMessageSerDes
java.lang.Object
io.micronaut.gcp.pubsub.serdes.JsonPubSubMessageSerDes
- All Implemented Interfaces:
PubSubMessageSerDes
A
PubSubMessageSerDes
implementation that uses Jackson ObjectMapper
to convert
application/json mime types.- Since:
- 2.0.0
- Author:
- Vinicius Carvalho
-
Constructor Summary
ConstructorsConstructorDescriptionJsonPubSubMessageSerDes
(com.fasterxml.jackson.databind.ObjectMapper mapper) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptiondeserialize
(byte[] data, io.micronaut.core.type.Argument<?> type) Deserializes data into a target type.byte[]
Serializes the message.
-
Constructor Details
-
JsonPubSubMessageSerDes
public JsonPubSubMessageSerDes(com.fasterxml.jackson.databind.ObjectMapper mapper) Default constructor.- Parameters:
mapper
- Jackson ObjectMapper
-
-
Method Details
-
deserialize
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
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
- Specified by:
supportedType
in interfacePubSubMessageSerDes
- Returns:
- The supported mime type this SerDes is capable of hanlding
-