All Downloads are FREE. Search and download functionalities are using the official Maven repository.

target.apidocs.com.google.api.services.pubsub.model.PubsubMessage.html Maven / Gradle / Ivy

There is a newer version: v1-rev20240730-2.0.0
Show newest version






PubsubMessage (Cloud Pub/Sub API v1-rev20240918-2.0.0)












com.google.api.services.pubsub.model

Class PubsubMessage

  • All Implemented Interfaces:
    Cloneable, Map<String,Object>


    public final class PubsubMessage
    extends com.google.api.client.json.GenericJson
    A message that is published by publishers and consumed by subscribers. The message must contain either a non-empty data field or at least one attribute. Note that client libraries represent this object differently depending on the language. See the corresponding [client library documentation](https://cloud.google.com/pubsub/docs/reference/libraries) for more information. See [quotas and limits] (https://cloud.google.com/pubsub/quotas) for more information about message limits.

    This is the Java data model class that specifies how to parse/serialize into the JSON that is transmitted over HTTP when working with the Cloud Pub/Sub API. For a detailed explanation see: https://developers.google.com/api-client-library/java/google-http-java-client/json

    Author:
    Google, Inc.
    • Constructor Detail

      • PubsubMessage

        public PubsubMessage()
    • Method Detail

      • getAttributes

        public Map<String,String> getAttributes()
        Optional. Attributes for this message. If this field is empty, the message must contain non- empty data. This can be used to filter messages on the subscription.
        Returns:
        value or null for none
      • setAttributes

        public PubsubMessage setAttributes(Map<String,String> attributes)
        Optional. Attributes for this message. If this field is empty, the message must contain non- empty data. This can be used to filter messages on the subscription.
        Parameters:
        attributes - attributes or null for none
      • getData

        public String getData()
        Optional. The message data field. If this field is empty, the message must contain at least one attribute.
        Returns:
        value or null for none
        See Also:
        decodeData()
      • decodeData

        public byte[] decodeData()
        Optional. The message data field. If this field is empty, the message must contain at least one attribute.
        Returns:
        Base64 decoded value or null for none
        Since:
        1.14
        See Also:
        getData()
      • setData

        public PubsubMessage setData(String data)
        Optional. The message data field. If this field is empty, the message must contain at least one attribute.
        Parameters:
        data - data or null for none
        See Also:
        #encodeData()
      • encodeData

        public PubsubMessage encodeData(byte[] data)
        Optional. The message data field. If this field is empty, the message must contain at least one attribute.
        Since:
        1.14
        See Also:

        The value is encoded Base64 or {@code null} for none.

      • getMessageId

        public String getMessageId()
        ID of this message, assigned by the server when the message is published. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push delivery. It must not be populated by the publisher in a `Publish` call.
        Returns:
        value or null for none
      • setMessageId

        public PubsubMessage setMessageId(String messageId)
        ID of this message, assigned by the server when the message is published. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push delivery. It must not be populated by the publisher in a `Publish` call.
        Parameters:
        messageId - messageId or null for none
      • getOrderingKey

        public String getOrderingKey()
        Optional. If non-empty, identifies related messages for which publish order should be respected. If a `Subscription` has `enable_message_ordering` set to `true`, messages published with the same non-empty `ordering_key` value will be delivered to subscribers in the order in which they are received by the Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest` must specify the same `ordering_key` value. For more information, see [ordering messages](https://cloud.google.com/pubsub/docs/ordering).
        Returns:
        value or null for none
      • setOrderingKey

        public PubsubMessage setOrderingKey(String orderingKey)
        Optional. If non-empty, identifies related messages for which publish order should be respected. If a `Subscription` has `enable_message_ordering` set to `true`, messages published with the same non-empty `ordering_key` value will be delivered to subscribers in the order in which they are received by the Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest` must specify the same `ordering_key` value. For more information, see [ordering messages](https://cloud.google.com/pubsub/docs/ordering).
        Parameters:
        orderingKey - orderingKey or null for none
      • getPublishTime

        public String getPublishTime()
        The time at which the message was published, populated by the server when it receives the `Publish` call. It must not be populated by the publisher in a `Publish` call.
        Returns:
        value or null for none
      • setPublishTime

        public PubsubMessage setPublishTime(String publishTime)
        The time at which the message was published, populated by the server when it receives the `Publish` call. It must not be populated by the publisher in a `Publish` call.
        Parameters:
        publishTime - publishTime or null for none
      • set

        public PubsubMessage set(String fieldName,
                                 Object value)
        Overrides:
        set in class com.google.api.client.json.GenericJson
      • clone

        public PubsubMessage clone()
        Overrides:
        clone in class com.google.api.client.json.GenericJson

Copyright © 2011–2024 Google. All rights reserved.





© 2015 - 2024 Weber Informatics LLC | Privacy Policy