pulsar-client-cpp
Public Types | Public Member Functions | Friends | List of all members
pulsar::Message Class Reference

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
 
const MessageIdgetMessageId () const
 
const std::string & getPartitionKey () const
 
bool hasPartitionKey () const
 
uint64_t getPublishTimestamp () const
 

Friends

class PartitionedProducerImpl
 
class PartitionedConsumerImpl
 
class MessageBuilder
 
class ConsumerImpl
 
class ProducerImpl
 
class Commands
 
class BatchMessageContainer
 
class BatchAcknowledgementTracker
 
class PulsarWrapper
 
std::ostream & operator<< (std::ostream &s, const StringMap &map)
 
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

Returns
the pointer to the message payload

◆ getDataAsString()

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

Get string representation of the message

Returns
the string representation of the message payload

◆ getLength()

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

Get the length of the message

Returns
the length of the message payload

◆ 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.

◆ getPartitionKey()

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

Get the partition key for this message

Returns
key string that is hashed to determine message's destination 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

Returns
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

Parameters
namethe name of the property
Returns
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

◆ hasProperty()

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

Check whether the message has a specific property attached.

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

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