No Matches
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
pulsar::Message Class Reference
Inheritance diagram for pulsar::Message:
pulsar::TypedMessage< T >

Public Types

typedef std::map< std::string, std::string > StringMap

Public Member Functions

const StringMap & getProperties () const
bool hasProperty (const std::string &name) const
const std::string & getProperty (const std::string &name) const
const void * getData () const
std::size_t getLength () const
std::string getDataAsString () const
KeyValue getKeyValueData () const
const MessageIdgetMessageId () const
void setMessageId (const MessageId &messageId) const
int64_t getIndex () const
const std::string & getPartitionKey () const
bool hasPartitionKey () const
const std::string & getOrderingKey () const
bool hasOrderingKey () const
uint64_t getPublishTimestamp () const
uint64_t getEventTimestamp () const
const std::string & getTopicName () const
const int getRedeliveryCount () const
bool hasSchemaVersion () const
int64_t getLongSchemaVersion () const
const std::string & getSchemaVersion () const
bool operator== (const Message &msg) const

Protected Types

typedef std::shared_ptr< MessageImpl > MessageImplPtr

Protected Member Functions

 Message (MessageImplPtr &impl)
 Message (const MessageId &messageId, proto::BrokerEntryMetadata &brokerEntryMetadata, proto::MessageMetadata &metadata, SharedBuffer &payload)
 Message (const MessageId &messageId, proto::BrokerEntryMetadata &brokerEntryMetadata, proto::MessageMetadata &metadata, SharedBuffer &payload, proto::SingleMessageMetadata &singleMetadata, const std::shared_ptr< std::string > &topicName)
 Used for Batch Messages.

Protected Attributes

MessageImplPtr impl_


class PartitionedProducerImpl
class MultiTopicsConsumerImpl
class MessageBuilder
class ConsumerImpl
class ProducerImpl
class Commands
class BatchMessageContainerBase
class BatchAcknowledgementTracker
class PulsarWrapper
class MessageBatch
struct OpSendMsg
class PulsarFriend
PULSAR_PUBLIC std::ostream & operator<< (std::ostream &s, const StringMap &map)
PULSAR_PUBLIC std::ostream & operator<< (std::ostream &s, const Message &msg)

Member Function Documentation

◆ getData()

const void * pulsar::Message::getData ( ) const

Get the content of the message

the pointer to the message payload

◆ getDataAsString()

std::string pulsar::Message::getDataAsString ( ) const

Get string representation of the message

the string representation of the message payload

NOTE: For MSVC with debug mode, return a thread local std::string object to avoid memory allocation across DLLs and applications, which could lead to a crash.

◆ getEventTimestamp()

uint64_t pulsar::Message::getEventTimestamp ( ) const

Get the event timestamp associated with this message. It is set by the client producer.

◆ getIndex()

int64_t pulsar::Message::getIndex ( ) const

Get the index of this message, if it doesn't exist, return -1


◆ getKeyValueData()

KeyValue pulsar::Message::getKeyValueData ( ) const

Get key value message.

key value message.

◆ getLength()

std::size_t pulsar::Message::getLength ( ) const

Get the length of the message

the length of the message payload

◆ getLongSchemaVersion()

int64_t pulsar::Message::getLongSchemaVersion ( ) const

Get the schema version.

the the schema version on success or -1 if the message does not have the schema version

◆ getMessageId()

const MessageId & pulsar::Message::getMessageId ( ) const

Get the unique message ID associated with this message.

The message id can be used to univocally refer to a message without having to keep the entire payload in memory.

Only messages received from the consumer will have a message id assigned.

◆ getOrderingKey()

const std::string & pulsar::Message::getOrderingKey ( ) const

Get the ordering key of the message

the ordering key of the message

◆ getPartitionKey()

const std::string & pulsar::Message::getPartitionKey ( ) const

Get the partition key for this message

key string that is hashed to determine message's topic partition

◆ getProperties()

const StringMap & pulsar::Message::getProperties ( ) const

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

an unmodifiable view of the properties map

◆ getProperty()

const std::string & pulsar::Message::getProperty ( const std::string &  name) const

Get the value of a specific property

namethe name of the property
the value of the property or null if the property was not defined

◆ getPublishTimestamp()

uint64_t pulsar::Message::getPublishTimestamp ( ) const

Get the UTC based timestamp in milliseconds referring to when the message was published by the client producer

◆ getRedeliveryCount()

const int pulsar::Message::getRedeliveryCount ( ) const

Get the redelivery count for this message

◆ getSchemaVersion()

const std::string & pulsar::Message::getSchemaVersion ( ) const

Get the schema version of the raw bytes.

◆ getTopicName()

const std::string & pulsar::Message::getTopicName ( ) const

Get the topic Name from which this message originated from

◆ hasOrderingKey()

bool pulsar::Message::hasOrderingKey ( ) const

Check whether the message has a ordering key

true if the ordering key was set while creating the message false if the ordering key was not set while creating the message

◆ hasPartitionKey()

bool pulsar::Message::hasPartitionKey ( ) const
true if the message has a partition key

◆ hasProperty()

bool pulsar::Message::hasProperty ( const std::string &  name) const

Check whether the message has a specific property attached.

namethe name of the property to check
true if the message has the specified property
false if the property is not defined

◆ hasSchemaVersion()

bool pulsar::Message::hasSchemaVersion ( ) const

Check if schema version exists

◆ setMessageId()

void pulsar::Message::setMessageId ( const MessageId messageId) const

Set the unique message ID.

The documentation for this class was generated from the following file: