Class MessageTransforms

java.lang.Object
com.google.cloud.pubsublite.cloudpubsub.MessageTransforms

public class MessageTransforms extends Object
MessageTransforms details how to transform message representations from Cloud Pub/Sub to Pub/Sub Lite.

Transformers are made public to allow user code that currently uses PubsubMessages to use interfaces interacting with Pub/Sub Lite.

  • Field Details

    • PUBSUB_LITE_EVENT_TIME_TIMESTAMP_PROTO

      public static final String PUBSUB_LITE_EVENT_TIME_TIMESTAMP_PROTO
      See Also:
  • Method Details

    • encodeAttributeEventTime

      public static String encodeAttributeEventTime(com.google.protobuf.Timestamp timestamp)
      Encode a timestamp in a way that it will be interpreted as an event time if published on a message with an attribute named PUBSUB_LITE_EVENT_TIME_TIMESTAMP_PROTO.
    • decodeAttributeEventTime

      public static com.google.protobuf.Timestamp decodeAttributeEventTime(String encoded) throws com.google.api.gax.rpc.ApiException
      Decode a timestamp encoded with encodeAttributeEventTime.
      Throws:
      com.google.api.gax.rpc.ApiException
    • toCpsSubscribeTransformer

      public static MessageTransformer<SequencedMessage,com.google.pubsub.v1.PubsubMessage> toCpsSubscribeTransformer()
    • toCpsPublishTransformer

      public static MessageTransformer<Message,com.google.pubsub.v1.PubsubMessage> toCpsPublishTransformer()
    • fromCpsPublishTransformer

      public static MessageTransformer<com.google.pubsub.v1.PubsubMessage,Message> fromCpsPublishTransformer(KeyExtractor keyExtractor)