MigratoryData Client API for C++
Developer's Guide and Reference Manual
MigratoryDataMessage Class Reference

Represent a message. More...

Public Member Functions

 MigratoryDataMessage ()
 Default constructor.
 
 MigratoryDataMessage (const MigratoryDataMessage &message)
 Copy constructor. More...
 
 MigratoryDataMessage (const std::string &subject, const std::string &content)
 Create a MigratoryDataMessage object. More...
 
 MigratoryDataMessage (const std::string &subject, const std::string &content, const std::string &closure)
 Create a MigratoryDataMessage object. More...
 
 MigratoryDataMessage (const std::string &subject, const std::string &content, std::vector< MigratoryDataField > &fields)
 Create a MigratoryDataMessage object. More...
 
 MigratoryDataMessage (const std::string &subject, const std::string &content, std::vector< MigratoryDataField > &fields, const std::string &closure)
 Create a MigratoryDataMessage object. More...
 
std::string getSubject () const
 Get the subject of the message. More...
 
std::string getContent () const
 Get the content of the message. More...
 
std::vector< MigratoryDataFieldgetFields () const
 Get the fields of the message. More...
 
std::string getClosure () const
 Get the closure of the message. More...
 
bool isSnapshot () const
 Test whether the message is a snapshot message or not. More...
 
void setReplyTosubject (std::string &replyToSubject)
 
std::string getReplyToSubject () const
 
virtual ~MigratoryDataMessage ()
 Destructor.
 

Protected Attributes

bool snapshot
 
bool recovery
 
int seq
 
int epoch
 

Detailed Description

Represent a message.

Constructor & Destructor Documentation

◆ MigratoryDataMessage() [1/5]

MigratoryDataMessage::MigratoryDataMessage ( const MigratoryDataMessage message)

Copy constructor.

Parameters
messageA MigratoryDataMessage object

◆ MigratoryDataMessage() [2/5]

MigratoryDataMessage::MigratoryDataMessage ( const std::string &  subject,
const std::string &  content 
)

Create a MigratoryDataMessage object.

Parameters
subjectThe subject of the message
contentThe content of the message

◆ MigratoryDataMessage() [3/5]

MigratoryDataMessage::MigratoryDataMessage ( const std::string &  subject,
const std::string &  content,
const std::string &  closure 
)

Create a MigratoryDataMessage object.

Parameters
subjectThe subject of the message
contentThe content of the message
closureThe closure of the message

◆ MigratoryDataMessage() [4/5]

MigratoryDataMessage::MigratoryDataMessage ( const std::string &  subject,
const std::string &  content,
std::vector< MigratoryDataField > &  fields 
)

Create a MigratoryDataMessage object.

Parameters
subjectThe subject of the message
contentThe content of the message
fieldsThe fields of the message

◆ MigratoryDataMessage() [5/5]

MigratoryDataMessage::MigratoryDataMessage ( const std::string &  subject,
const std::string &  content,
std::vector< MigratoryDataField > &  fields,
const std::string &  closure 
)

Create a MigratoryDataMessage object.

Parameters
subjectThe subject of the message
contentThe content of the message
fieldsThe fields of the message
closureThe closure of the message

Member Function Documentation

◆ getSubject()

std::string MigratoryDataMessage::getSubject ( ) const

Get the subject of the message.

Returns
A string representing the subject of the message

◆ getContent()

std::string MigratoryDataMessage::getContent ( ) const

Get the content of the message.

Returns
A string representing the content of the message

◆ getFields()

std::vector<MigratoryDataField> MigratoryDataMessage::getFields ( ) const

Get the fields of the message.

Returns
The fields of the message as a list of MigratoryDataField objects

◆ getClosure()

std::string MigratoryDataMessage::getClosure ( ) const

Get the closure of the message.

Returns
The closure data of the message

◆ isSnapshot()

bool MigratoryDataMessage::isSnapshot ( ) const

Test whether the message is a snapshot message or not.

Returns
true if the message is a snapshot message

◆ setReplyTosubject()

void MigratoryDataMessage::setReplyTosubject ( std::string &  replyToSubject)

Set the subject to be used to reply to this message.

If a reply subject is attached to a message with this method, the message acts as a request. The clients which receive a request message will be able to reply by sending a message having as subject the reply subject.

If the reply subject is not already subscribed, it is subscribed by the API library implicitly. It can be reused for subsequent request/reply interactions (and even for receiving multiple replies to one request). When it is not needed anymore, it should be unsubscribed explicitly.

Parameters
subjectThe subject to be used to reply to this message.

◆ getReplyToSubject()

std::string MigratoryDataMessage::getReplyToSubject ( ) const

Get the subject to be used to reply to this message.

A client which receives a message containing a reply subject should interpret the message as a request. It has the option to use the reply subject - extracted from the message with this method - to send a reply.

Returns
The subject to be used to reply to this message.