public interface Message<T>
Modifier and Type | Method and Description |
---|---|
byte[] |
getData()
Get the raw payload of the message.
|
Optional<EncryptionContext> |
getEncryptionCtx()
EncryptionContext contains encryption and compression information in it using which application can
decrypt consumed message with encrypted-payload. |
long |
getEventTime()
Get the event time associated with this message.
|
String |
getKey()
Get the key of the message.
|
byte[] |
getKeyBytes()
Get bytes in key.
|
MessageId |
getMessageId()
Get the unique message ID associated with this message.
|
byte[] |
getOrderingKey()
Get the ordering key of the message.
|
String |
getProducerName()
Get the producer name who produced this message.
|
Map<String,String> |
getProperties()
Return the properties attached to the message.
|
String |
getProperty(String name)
Get the value of a specific property.
|
long |
getPublishTime()
Get the publish time of this message.
|
int |
getRedeliveryCount()
Get message redelivery count, redelivery count maintain in pulsar broker.
|
String |
getReplicatedFrom()
Get name of cluster, from which the message is replicated.
|
byte[] |
getSchemaVersion()
Get schema version of the message.
|
long |
getSequenceId()
Get the sequence id associated with this message.
|
String |
getTopicName()
Get the topic the message was published to.
|
T |
getValue()
Get the de-serialized value of the message, according the configured
Schema . |
boolean |
hasBase64EncodedKey()
Check whether the key has been base64 encoded.
|
boolean |
hasKey()
Check whether the message has a key.
|
boolean |
hasOrderingKey()
Check whether the message has a ordering key.
|
boolean |
hasProperty(String name)
Check whether the message has a specific property attached.
|
boolean |
isReplicated()
Check whether the message is replicated from other cluster.
|
Map<String,String> getProperties()
Properties are application defined key/value pairs that will be attached to the message.
boolean hasProperty(String name)
name
- the name of the property to checkString getProperty(String name)
name
- the name of the propertybyte[] getData()
Even when using the Schema and type-safe API, an application has access to the underlying raw message payload.
T getValue()
Schema
.MessageId getMessageId()
The message id can be used to univocally refer to a message without having the keep the entire payload in memory.
Only messages received from the consumer will have a message id assigned.
long getPublishTime()
getEventTime()
long getEventTime()
MessageBuilder#setEventTime(long)
.
If there isn't any event time associated with this event, it will return 0.
MessageBuilder#setEventTime(long)
long getSequenceId()
MessageBuilder#setSequenceId(long)
.MessageBuilder#setEventTime(long)
String getProducerName()
boolean hasKey()
String getKey()
boolean hasBase64EncodedKey()
byte[] getKeyBytes()
boolean hasOrderingKey()
byte[] getOrderingKey()
String getTopicName()
Optional<EncryptionContext> getEncryptionCtx()
EncryptionContext
contains encryption and compression information in it using which application can
decrypt consumed message with encrypted-payload.int getRedeliveryCount()
Message redelivery increases monotonically in a broker, when topic switch ownership to a another broker redelivery count will be recalculated.
byte[] getSchemaVersion()
boolean isReplicated()
String getReplicatedFrom()
Copyright © 2017–2020 Apache Software Foundation. All rights reserved.