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 a JsonMapper
to convert
application/json mime types.- Since:
- 2.0.0
- Author:
- Vinicius Carvalho, Dean Wette
-
Constructor Summary
ConstructorDescriptionJsonPubSubMessageSerDes
(io.micronaut.json.JsonMapper jsonMapper) 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(io.micronaut.json.JsonMapper jsonMapper) Default constructor.- Parameters:
jsonMapper
- Json 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
-