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

Public Types

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

Public Member Functions

Message build ()
 
MessageBuildersetContent (const void *data, size_t size)
 
MessageBuildersetContent (const std::string &data)
 
MessageBuildersetAllocatedContent (void *data, size_t size)
 
MessageBuildersetProperty (const std::string &name, const std::string &value)
 
MessageBuildersetProperties (const StringMap &properties)
 
MessageBuildersetPartitionKey (const std::string &partitionKey)
 
MessageBuildersetReplicationClusters (const std::vector< std::string > &clusters)
 
MessageBuilderdisableReplication (bool flag)
 
MessageBuildercreate ()
 

Friends

class PulsarWrapper
 

Member Function Documentation

◆ build()

Message pulsar::MessageBuilder::build ( )

Finalize the immutable message

◆ create()

MessageBuilder& pulsar::MessageBuilder::create ( )

create a empty message, with no properties or data

◆ disableReplication()

MessageBuilder& pulsar::MessageBuilder::disableReplication ( bool  flag)

Do not replicate this message

Parameters
flagif true, disable replication, otherwise use default replication

◆ setAllocatedContent()

MessageBuilder& pulsar::MessageBuilder::setAllocatedContent ( void *  data,
size_t  size 
)

Set content of the message to a buffer already allocated by the caller. No copies of this buffer will be made. The caller is responsible to ensure the memory buffer is valid until the message has been persisted (or an error is returned).

◆ setContent()

MessageBuilder& pulsar::MessageBuilder::setContent ( const void *  data,
size_t  size 
)

Set content of the message. The message contents will be managed by the system.

◆ setProperties()

MessageBuilder& pulsar::MessageBuilder::setProperties ( const StringMap &  properties)

Add all the properties in the provided map

◆ setProperty()

MessageBuilder& pulsar::MessageBuilder::setProperty ( const std::string &  name,
const std::string &  value 
)

Sets a new property on a message.

Parameters
namethe name of the property
valuethe associated value

◆ setReplicationClusters()

MessageBuilder& pulsar::MessageBuilder::setReplicationClusters ( const std::vector< std::string > &  clusters)

override namespace replication clusters. note that it is the caller's responsibility to provide valid cluster names, and that all clusters have been previously configured as destinations.

given an empty list, the message will replicate per the namespace configuration.

Parameters
clusterswhere to send this message.

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