Class JsonPubSubMessageSerDes

java.lang.Object
io.micronaut.gcp.pubsub.serdes.JsonPubSubMessageSerDes
All Implemented Interfaces:
PubSubMessageSerDes

@Singleton public class JsonPubSubMessageSerDes extends Object implements PubSubMessageSerDes
A PubSubMessageSerDes implementation that uses a JsonMapper to convert application/json mime types.
Since:
2.0.0
Author:
Vinicius Carvalho, Dean Wette
  • Constructor Details

    • JsonPubSubMessageSerDes

      public JsonPubSubMessageSerDes(io.micronaut.json.JsonMapper jsonMapper)
      Default constructor.
      Parameters:
      jsonMapper - Json ObjectMapper
  • Method Details

    • deserialize

      public 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 interface PubSubMessageSerDes
      Parameters:
      data - byte data to deserialize
      type - target type
      Returns:
      the deserialized java type
    • serialize

      public byte[] serialize(Object data)
      Description copied from interface: PubSubMessageSerDes
      Serializes the message.
      Specified by:
      serialize in interface PubSubMessageSerDes
      Parameters:
      data - data to serialize
      Returns:
      byte array of serialized data
    • supportedType

      public String supportedType()
      Specified by:
      supportedType in interface PubSubMessageSerDes
      Returns:
      The supported mime type this SerDes is capable of hanlding