Class PubsubMessage
- java.lang.Object
-
- org.apache.beam.sdk.io.gcp.pubsub.PubsubMessage
-
public class PubsubMessage extends java.lang.Object
Class representing a Pub/Sub message. Each message contains a single message payload, a map of attached attributes, a message id and an ordering key.
-
-
Constructor Summary
Constructors Constructor Description PubsubMessage(byte[] payload, @Nullable java.util.Map<java.lang.String,java.lang.String> attributes)
PubsubMessage(byte[] payload, @Nullable java.util.Map<java.lang.String,java.lang.String> attributes, @Nullable java.lang.String messageId)
PubsubMessage(byte[] payload, @Nullable java.util.Map<java.lang.String,java.lang.String> attributes, @Nullable java.lang.String messageId, @Nullable java.lang.String orderingKey)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object other)
@Nullable java.lang.String
getAttribute(java.lang.String attribute)
Returns the given attribute value.@Nullable java.util.Map<java.lang.String,java.lang.String>
getAttributeMap()
Returns the full map of attributes.@Nullable java.lang.String
getMessageId()
Returns the messageId of the message populated by Cloud Pub/Sub.@Nullable java.lang.String
getOrderingKey()
Returns the ordering key of the message.byte[]
getPayload()
Returns the main PubSub message.int
hashCode()
java.lang.String
toString()
-
-
-
Constructor Detail
-
PubsubMessage
public PubsubMessage(byte[] payload, @Nullable java.util.Map<java.lang.String,java.lang.String> attributes)
-
PubsubMessage
public PubsubMessage(byte[] payload, @Nullable java.util.Map<java.lang.String,java.lang.String> attributes, @Nullable java.lang.String messageId)
-
PubsubMessage
public PubsubMessage(byte[] payload, @Nullable java.util.Map<java.lang.String,java.lang.String> attributes, @Nullable java.lang.String messageId, @Nullable java.lang.String orderingKey)
-
-
Method Detail
-
getPayload
public byte[] getPayload()
Returns the main PubSub message.
-
getAttribute
public @Nullable java.lang.String getAttribute(java.lang.String attribute)
Returns the given attribute value. If not such attribute exists, returns null.
-
getAttributeMap
public @Nullable java.util.Map<java.lang.String,java.lang.String> getAttributeMap()
Returns the full map of attributes. This is an unmodifiable map.
-
getMessageId
public @Nullable java.lang.String getMessageId()
Returns the messageId of the message populated by Cloud Pub/Sub.
-
getOrderingKey
public @Nullable java.lang.String getOrderingKey()
Returns the ordering key of the message.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-