Class PulsarIncomingMessageMetadata

java.lang.Object
io.smallrye.reactive.messaging.pulsar.PulsarIncomingMessageMetadata
All Implemented Interfaces:
PulsarMessageMetadata

public class PulsarIncomingMessageMetadata extends Object implements PulsarMessageMetadata
  • Method Details

    • getMessage

      public org.apache.pulsar.client.api.Message<?> getMessage()
    • getMessageId

      public org.apache.pulsar.client.api.MessageId getMessageId()
    • getProperties

      public Map<String,String> getProperties()
      Description copied from interface: PulsarMessageMetadata
      Return the properties attached to the message.

      Properties are application defined key/value pairs that will be attached to the message.

      Specified by:
      getProperties in interface PulsarMessageMetadata
      Returns:
      an unmodifiable view of the properties map
    • hasProperty

      public boolean hasProperty(String name)
      Description copied from interface: PulsarMessageMetadata
      Check whether the message has a specific property attached.
      Specified by:
      hasProperty in interface PulsarMessageMetadata
      Parameters:
      name - the name of the property to check
      Returns:
      true if the message has the specified property and false if the properties is not defined
    • getProperty

      public String getProperty(String name)
      Description copied from interface: PulsarMessageMetadata
      Get the value of a specific property.
      Specified by:
      getProperty in interface PulsarMessageMetadata
      Parameters:
      name - the name of the property
      Returns:
      the value of the property or null if the property was not defined
    • getData

      public byte[] getData()
    • size

      public int size()
      Description copied from interface: PulsarMessageMetadata
      Get the uncompressed message payload size in bytes.
      Specified by:
      size in interface PulsarMessageMetadata
      Returns:
      size in bytes.
    • getPublishTime

      public long getPublishTime()
      Description copied from interface: PulsarMessageMetadata
      Get the publish time of this message. The publish time is the timestamp that a client publish the message.
      Specified by:
      getPublishTime in interface PulsarMessageMetadata
      Returns:
      publish time of this message.
      See Also:
    • getEventTime

      public long getEventTime()
      Description copied from interface: PulsarMessageMetadata
      Get the event time associated with this message.

      If there isn't any event time associated with this event, it will return 0.

      Specified by:
      getEventTime in interface PulsarMessageMetadata
      Returns:
      the message event time or 0 if event time wasn't set
    • hasKey

      public boolean hasKey()
      Description copied from interface: PulsarMessageMetadata
      Check whether the message has a key.
      Specified by:
      hasKey in interface PulsarMessageMetadata
      Returns:
      true if the key was set while creating the message and false if the key was not set while creating the message
    • getKey

      public String getKey()
      Description copied from interface: PulsarMessageMetadata
      Get the key of the message.
      Specified by:
      getKey in interface PulsarMessageMetadata
      Returns:
      the key of the message
    • hasBase64EncodedKey

      public boolean hasBase64EncodedKey()
      Description copied from interface: PulsarMessageMetadata
      Check whether the key has been base64 encoded.
      Specified by:
      hasBase64EncodedKey in interface PulsarMessageMetadata
      Returns:
      true if the key is base64 encoded, false otherwise
    • getKeyBytes

      public byte[] getKeyBytes()
      Description copied from interface: PulsarMessageMetadata
      Get bytes in key. If the key has been base64 encoded, it is decoded before being returned. Otherwise, if the key is a plain string, this method returns the UTF_8 encoded bytes of the string.
      Specified by:
      getKeyBytes in interface PulsarMessageMetadata
      Returns:
      the key in byte[] form
    • hasOrderingKey

      public boolean hasOrderingKey()
      Description copied from interface: PulsarMessageMetadata
      Check whether the message has a ordering key.
      Specified by:
      hasOrderingKey in interface PulsarMessageMetadata
      Returns:
      true if the ordering key was set while creating the message false if the ordering key was not set while creating the message
    • getOrderingKey

      public byte[] getOrderingKey()
      Description copied from interface: PulsarMessageMetadata
      Get the ordering key of the message.
      Specified by:
      getOrderingKey in interface PulsarMessageMetadata
      Returns:
      the ordering key of the message
    • getTopicName

      public String getTopicName()
      Description copied from interface: PulsarMessageMetadata
      Get the topic the message was published to.
      Specified by:
      getTopicName in interface PulsarMessageMetadata
      Returns:
      the topic the message was published to
    • getRedeliveryCount

      public int getRedeliveryCount()
      Description copied from interface: PulsarMessageMetadata
      Get message redelivery count, redelivery count maintain in pulsar broker. When client acknowledge message timeout, broker will dispatch message again with message redelivery count in CommandMessage defined.

      Message redelivery increases monotonically in a broker, when topic switch ownership to a another broker redelivery count will be recalculated.

      Specified by:
      getRedeliveryCount in interface PulsarMessageMetadata
      Returns:
      message redelivery count
    • getSchemaVersion

      public byte[] getSchemaVersion()
      Description copied from interface: PulsarMessageMetadata
      Get schema version of the message.
      Specified by:
      getSchemaVersion in interface PulsarMessageMetadata
      Returns:
      Schema version of the message if the message is produced with schema otherwise null.
    • isReplicated

      public boolean isReplicated()
      Description copied from interface: PulsarMessageMetadata
      Check whether the message is replicated from other cluster.
      Specified by:
      isReplicated in interface PulsarMessageMetadata
      Returns:
      true if the message is replicated from other cluster. false otherwise.
    • getReplicatedFrom

      public String getReplicatedFrom()
      Description copied from interface: PulsarMessageMetadata
      Get name of cluster, from which the message is replicated.
      Specified by:
      getReplicatedFrom in interface PulsarMessageMetadata
      Returns:
      the name of cluster, from which the message is replicated.
    • hasBrokerPublishTime

      public boolean hasBrokerPublishTime()
      Description copied from interface: PulsarMessageMetadata
      Check whether the message has a broker publish time
      Specified by:
      hasBrokerPublishTime in interface PulsarMessageMetadata
      Returns:
      true if the message has a broker publish time, otherwise false.
    • getBrokerPublishTime

      public Optional<Long> getBrokerPublishTime()
      Description copied from interface: PulsarMessageMetadata
      Get broker publish time from broker entry metadata. Note that only if the feature is enabled in the broker then the value is available.
      Specified by:
      getBrokerPublishTime in interface PulsarMessageMetadata
      Returns:
      broker publish time from broker entry metadata, or empty if the feature is not enabled in the broker.
    • hasIndex

      public boolean hasIndex()
      Description copied from interface: PulsarMessageMetadata
      Check whether the message has an index.
      Specified by:
      hasIndex in interface PulsarMessageMetadata
      Returns:
      true if the message has an index, otherwise false.
    • getIndex

      public Optional<Long> getIndex()
      Description copied from interface: PulsarMessageMetadata
      Get index from broker entry metadata. Note that only if the feature is enabled in the broker then the value is available.
      Specified by:
      getIndex in interface PulsarMessageMetadata
      Returns:
      index from broker entry metadata, or empty if the feature is not enabled in the broker.