Class PulsarIncomingMessageMetadata
java.lang.Object
io.smallrye.reactive.messaging.pulsar.PulsarIncomingMessageMetadata
- All Implemented Interfaces:
PulsarMessageMetadata
-
Method Summary
Modifier and TypeMethodDescriptionGet broker publish time from broker entry metadata.byte[]getData()longGet the event time associated with this message.getIndex()Get index from broker entry metadata.getKey()Get the key of the message.byte[]Get bytes in key.org.apache.pulsar.client.api.Message<?>org.apache.pulsar.client.api.MessageIdbyte[]Get the ordering key of the message.Return the properties attached to the message.getProperty(String name) Get the value of a specific property.longGet the publish time of this message.intGet message redelivery count, redelivery count maintain in pulsar broker.Get name of cluster, from which the message is replicated.byte[]Get schema version of the message.Get the topic the message was published to.booleanCheck whether the key has been base64 encoded.booleanCheck whether the message has a broker publish timebooleanhasIndex()Check whether the message has an index.booleanhasKey()Check whether the message has a key.booleanCheck whether the message has a ordering key.booleanhasProperty(String name) Check whether the message has a specific property attached.booleanCheck whether the message is replicated from other cluster.intsize()Get the uncompressed message payload size in bytes.
-
Method Details
-
getMessage
public org.apache.pulsar.client.api.Message<?> getMessage() -
getMessageId
public org.apache.pulsar.client.api.MessageId getMessageId() -
getProperties
Description copied from interface:PulsarMessageMetadataReturn the properties attached to the message.Properties are application defined key/value pairs that will be attached to the message.
- Specified by:
getPropertiesin interfacePulsarMessageMetadata- Returns:
- an unmodifiable view of the properties map
-
hasProperty
Description copied from interface:PulsarMessageMetadataCheck whether the message has a specific property attached.- Specified by:
hasPropertyin interfacePulsarMessageMetadata- 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
Description copied from interface:PulsarMessageMetadataGet the value of a specific property.- Specified by:
getPropertyin interfacePulsarMessageMetadata- 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:PulsarMessageMetadataGet the uncompressed message payload size in bytes.- Specified by:
sizein interfacePulsarMessageMetadata- Returns:
- size in bytes.
-
getPublishTime
public long getPublishTime()Description copied from interface:PulsarMessageMetadataGet the publish time of this message. The publish time is the timestamp that a client publish the message.- Specified by:
getPublishTimein interfacePulsarMessageMetadata- Returns:
- publish time of this message.
- See Also:
-
getEventTime
public long getEventTime()Description copied from interface:PulsarMessageMetadataGet the event time associated with this message.If there isn't any event time associated with this event, it will return 0.
- Specified by:
getEventTimein interfacePulsarMessageMetadata- Returns:
- the message event time or 0 if event time wasn't set
-
hasKey
public boolean hasKey()Description copied from interface:PulsarMessageMetadataCheck whether the message has a key.- Specified by:
hasKeyin interfacePulsarMessageMetadata- Returns:
- true if the key was set while creating the message and false if the key was not set while creating the message
-
getKey
Description copied from interface:PulsarMessageMetadataGet the key of the message.- Specified by:
getKeyin interfacePulsarMessageMetadata- Returns:
- the key of the message
-
hasBase64EncodedKey
public boolean hasBase64EncodedKey()Description copied from interface:PulsarMessageMetadataCheck whether the key has been base64 encoded.- Specified by:
hasBase64EncodedKeyin interfacePulsarMessageMetadata- Returns:
- true if the key is base64 encoded, false otherwise
-
getKeyBytes
public byte[] getKeyBytes()Description copied from interface:PulsarMessageMetadataGet 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:
getKeyBytesin interfacePulsarMessageMetadata- Returns:
- the key in byte[] form
-
hasOrderingKey
public boolean hasOrderingKey()Description copied from interface:PulsarMessageMetadataCheck whether the message has a ordering key.- Specified by:
hasOrderingKeyin interfacePulsarMessageMetadata- 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:PulsarMessageMetadataGet the ordering key of the message.- Specified by:
getOrderingKeyin interfacePulsarMessageMetadata- Returns:
- the ordering key of the message
-
getTopicName
Description copied from interface:PulsarMessageMetadataGet the topic the message was published to.- Specified by:
getTopicNamein interfacePulsarMessageMetadata- Returns:
- the topic the message was published to
-
getRedeliveryCount
public int getRedeliveryCount()Description copied from interface:PulsarMessageMetadataGet 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:
getRedeliveryCountin interfacePulsarMessageMetadata- Returns:
- message redelivery count
-
getSchemaVersion
public byte[] getSchemaVersion()Description copied from interface:PulsarMessageMetadataGet schema version of the message.- Specified by:
getSchemaVersionin interfacePulsarMessageMetadata- Returns:
- Schema version of the message if the message is produced with schema otherwise null.
-
isReplicated
public boolean isReplicated()Description copied from interface:PulsarMessageMetadataCheck whether the message is replicated from other cluster.- Specified by:
isReplicatedin interfacePulsarMessageMetadata- Returns:
- true if the message is replicated from other cluster. false otherwise.
-
getReplicatedFrom
Description copied from interface:PulsarMessageMetadataGet name of cluster, from which the message is replicated.- Specified by:
getReplicatedFromin interfacePulsarMessageMetadata- Returns:
- the name of cluster, from which the message is replicated.
-
hasBrokerPublishTime
public boolean hasBrokerPublishTime()Description copied from interface:PulsarMessageMetadataCheck whether the message has a broker publish time- Specified by:
hasBrokerPublishTimein interfacePulsarMessageMetadata- Returns:
- true if the message has a broker publish time, otherwise false.
-
getBrokerPublishTime
Description copied from interface:PulsarMessageMetadataGet 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:
getBrokerPublishTimein interfacePulsarMessageMetadata- 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:PulsarMessageMetadataCheck whether the message has an index.- Specified by:
hasIndexin interfacePulsarMessageMetadata- Returns:
- true if the message has an index, otherwise false.
-
getIndex
Description copied from interface:PulsarMessageMetadataGet index from broker entry metadata. Note that only if the feature is enabled in the broker then the value is available.- Specified by:
getIndexin interfacePulsarMessageMetadata- Returns:
- index from broker entry metadata, or empty if the feature is not enabled in the broker.
-