qpid::client::Message Class Reference

Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET | Apache Qpid Documentation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
qpid::client::Message Class Reference

A message sent to or received from the broker. More...

`#include <qpid/client/Message.h>`

List of all members.

## Public Member Functions
| Message (const std::string &data=std::string(), const std::string &routingKey=std::string())
| Create a Message.
| Message (MessageImpl *)
| Message (const Message &)
| ~Message ()
Message & | operator= (const Message &)
void | swap (Message &)
void | setData (const std::string &)
const std::string & | getData () const
std::string & | getData ()
void | appendData (const std::string &)
bool | hasMessageProperties () const
framing::MessageProperties & | getMessageProperties ()
const framing::MessageProperties & | getMessageProperties () const
bool | hasDeliveryProperties () const
framing::DeliveryProperties & | getDeliveryProperties ()
const framing::DeliveryProperties & | getDeliveryProperties () const
std::string | getDestination () const
| The destination of messages sent to the broker is the exchange name.
bool | isRedelivered () const
| Check the redelivered flag.
void | setRedelivered (bool redelivered)
| Set the redelivered flag.
framing::FieldTable & | getHeaders ()
| Get a modifyable reference to the message headers.
const framing::FieldTable & | getHeaders () const
| Get a non-modifyable reference to the message headers.
const framing::SequenceNumber & | getId () const

## Detailed Description

A message sent to or received from the broker.

## Getting and setting message contents

- getData()

      std::cout << "Response: " << message.getData() << std::endl;

- setData()

      message.setData("That's all, folks!");

- appendData()

      message.appendData(" ... let's add a bit more ...");

## Getting and Setting Delivery Properties

- getDeliveryProperties()

      message.getDeliveryProperties().setRoutingKey("control");

      message.getDeliveryProperties().setDeliveryMode(PERSISTENT);

      message.getDeliveryProperties().setPriority(9);

      message.getDeliveryProperties().setTtl(100);

- hasDeliveryProperties()

      if (! message.hasDeliveryProperties()) {
        ...
      }

## Getting and Setting Message Properties

- getMessageProperties()

      request.getMessageProperties().setReplyTo(ReplyTo("amq.direct", response_queue.str()));

      routingKey = request.getMessageProperties().getReplyTo().getRoutingKey();
      exchange = request.getMessageProperties().getReplyTo().getExchange();

      message.getMessageProperties().setContentType("text/plain");

      message.getMessageProperties().setContentEncoding("text/plain");

- hasMessageProperties()

      request.getMessageProperties().hasReplyTo();

## Getting and Setting Application Headers

- getHeaders()

      message.getHeaders().getString("control");

      message.getHeaders().setString("control","continue");

## Constructor & Destructor Documentation

qpid::client::Message::Message | ( | const std::string & | data = `std::string()`,
|  | const std::string & | routingKey = `std::string()`
| ) |  |

Create a Message.

Parameters:

  data | Data for the message body.
  routingKey | Passed to the exchange that routes the message.

qpid::client::Message::Message | ( | MessageImpl * |  | ) |

qpid::client::Message::Message | ( | const Message & |  | ) |

qpid::client::Message::~Message | ( |  | ) |

## Member Function Documentation

void qpid::client::Message::appendData | ( | const std::string & |  | ) |

const std::string& qpid::client::Message::getData | ( |  | ) | const

std::string& qpid::client::Message::getData | ( |  | ) |

framing::DeliveryProperties& qpid::client::Message::getDeliveryProperties | ( |  | ) |

const framing::DeliveryProperties& qpid::client::Message::getDeliveryProperties | ( |  | ) | const

std::string qpid::client::Message::getDestination | ( |  | ) | const

The destination of messages sent to the broker is the exchange name.

The destination of messages received from the broker is the delivery tag identifyig the local subscription (often this is the name of the subscribed queue.)

framing::FieldTable& qpid::client::Message::getHeaders | ( |  | ) |

Get a modifyable reference to the message headers.

const framing::FieldTable& qpid::client::Message::getHeaders | ( |  | ) | const

Get a non-modifyable reference to the message headers.

const framing::SequenceNumber& qpid::client::Message::getId | ( |  | ) | const

Referenced by qpid::client::Subscription::acquire(), qpid::client::Subscription::accept(), and qpid::client::Subscription::release().

framing::MessageProperties& qpid::client::Message::getMessageProperties | ( |  | ) |

const framing::MessageProperties& qpid::client::Message::getMessageProperties | ( |  | ) | const

bool qpid::client::Message::hasDeliveryProperties | ( |  | ) | const

bool qpid::client::Message::hasMessageProperties | ( |  | ) | const

bool qpid::client::Message::isRedelivered | ( |  | ) | const

Check the redelivered flag.

Message& qpid::client::Message::operator= | ( | const Message & |  | ) |

void qpid::client::Message::setData | ( | const std::string & |  | ) |

void qpid::client::Message::setRedelivered | ( | bool | redelivered | ) |

Set the redelivered flag.

void qpid::client::Message::swap | ( | Message & |  | ) |

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

- qpid/client/Message.h