Interface PubSubMessageConverter

All Known Implementing Classes:
JacksonPubSubMessageConverter, SimplePubSubMessageConverter

public interface PubSubMessageConverter
Interface for converters that can convert POJOs to and from Pub/Sub messages.
  • Method Summary

    Modifier and Type
    Method
    Description
    default com.google.pubsub.v1.PubsubMessage
    byteStringToPubSubMessage(com.google.protobuf.ByteString payload, Map<String,String> headers)
     
    <T> T
    fromPubSubMessage(com.google.pubsub.v1.PubsubMessage message, Class<T> payloadType)
    Convert the payload of a given PubsubMessage to a desired Java type.
    com.google.pubsub.v1.PubsubMessage
    toPubSubMessage(Object payload, Map<String,String> headers)
    Create a PubsubMessage given an object for the payload and a map of headers.
  • Method Details

    • toPubSubMessage

      com.google.pubsub.v1.PubsubMessage toPubSubMessage(Object payload, Map<String,String> headers)
      Create a PubsubMessage given an object for the payload and a map of headers.
      Parameters:
      payload - the object to place into the message payload
      headers - the headers of the message
      Returns:
      the PubsubMessage ready to be sent
    • fromPubSubMessage

      <T> T fromPubSubMessage(com.google.pubsub.v1.PubsubMessage message, Class<T> payloadType)
      Convert the payload of a given PubsubMessage to a desired Java type.
      Type Parameters:
      T - the type of the payload
      Parameters:
      message - the message containing the payload of the object
      payloadType - the desired type of the object
      Returns:
      the object converted from the message's payload
    • byteStringToPubSubMessage

      default com.google.pubsub.v1.PubsubMessage byteStringToPubSubMessage(com.google.protobuf.ByteString payload, Map<String,String> headers)