/usr/include/qpid/client/Message.h is in libqpidclient2-dev 0.14-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | #ifndef QPID_CLIENT_MESSAGE_H
#define QPID_CLIENT_MESSAGE_H
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
#include "qpid/client/ClientImportExport.h"
#include "qpid/framing/MessageProperties.h"
#include "qpid/framing/DeliveryProperties.h"
#include <string>
namespace qpid {
namespace framing {
class FieldTable;
class SequenceNumber; // FIXME aconway 2009-04-17: remove with getID?
}
namespace client {
class MessageImpl;
/**
* A message sent to or received from the broker.
*
* \ingroup clientapi
* \details
*
* <h2>Getting and setting message contents</h2>
*
* <ul>
* <li>
* <p>getData()</p>
* <pre>std::cout << "Response: " << message.getData() << std::endl;</pre>
* </li>
* <li>
* <p>setData()</p>
* <pre>message.setData("That's all, folks!");</pre></li>
* <li>
* <p>appendData()</p>
* <pre>message.appendData(" ... let's add a bit more ...");</pre></li>
* </ul>
*
* <h2>Getting and Setting Delivery Properties</h2>
*
* <ul>
* <li>
* <p>getDeliveryProperties()</p>
* <pre>message.getDeliveryProperties().setRoutingKey("control");</pre>
* <pre>message.getDeliveryProperties().setDeliveryMode(PERSISTENT);</pre>
* <pre>message.getDeliveryProperties().setPriority(9);</pre>
* <pre>message.getDeliveryProperties().setTtl(100);</pre></li>
*
* <li>
* <p>hasDeliveryProperties()</p>
* <pre>if (! message.hasDeliveryProperties()) {
* ...
*}</pre></li>
* </ul>
*
* <h2>Getting and Setting Message Properties</h2>
*
* <ul>
* <li>
* <p>getMessageProperties()</p>
* <pre>
*request.getMessageProperties().setReplyTo(ReplyTo("amq.direct", response_queue.str()));
* </pre>
* <pre>
*routingKey = request.getMessageProperties().getReplyTo().getRoutingKey();
*exchange = request.getMessageProperties().getReplyTo().getExchange();
* </pre>
* <pre>message.getMessageProperties().setContentType("text/plain");</pre>
* <pre>message.getMessageProperties().setContentEncoding("text/plain");</pre>
* </li>
* <li>
* <p>hasMessageProperties()</p>
* <pre>request.getMessageProperties().hasReplyTo();</pre>
* </li>
* </ul>
*
* <h2>Getting and Setting Application Headers</h2>
*
* <ul>
* <li>
* <p>getHeaders()</p>
* <pre>
*message.getHeaders().getString("control");
* </pre>
* <pre>
*message.getHeaders().setString("control","continue");
* </pre></li>
* </ul>
*
*
*/
class QPID_CLIENT_CLASS_EXTERN Message
{
public:
/** Create a Message.
*@param data Data for the message body.
*@param routingKey Passed to the exchange that routes the message.
*/
QPID_CLIENT_EXTERN Message(
const std::string& data=std::string(),
const std::string& routingKey=std::string());
Message(MessageImpl*); ///< @internal
QPID_CLIENT_EXTERN Message(const Message&);
QPID_CLIENT_EXTERN ~Message();
QPID_CLIENT_EXTERN Message& operator=(const Message&);
QPID_CLIENT_EXTERN void swap(Message&);
QPID_CLIENT_EXTERN void setData(const std::string&);
QPID_CLIENT_EXTERN const std::string& getData() const;
QPID_CLIENT_EXTERN std::string& getData();
QPID_CLIENT_EXTERN void appendData(const std::string&);
QPID_CLIENT_EXTERN bool hasMessageProperties() const;
QPID_CLIENT_EXTERN framing::MessageProperties& getMessageProperties();
QPID_CLIENT_EXTERN const framing::MessageProperties& getMessageProperties() const;
QPID_CLIENT_EXTERN bool hasDeliveryProperties() const;
QPID_CLIENT_EXTERN framing::DeliveryProperties& getDeliveryProperties();
QPID_CLIENT_EXTERN const framing::DeliveryProperties& getDeliveryProperties() 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.)
*/
QPID_CLIENT_EXTERN std::string getDestination() const;
/** Check the redelivered flag. */
QPID_CLIENT_EXTERN bool isRedelivered() const;
/** Set the redelivered flag. */
QPID_CLIENT_EXTERN void setRedelivered(bool redelivered);
/** Get a modifyable reference to the message headers. */
QPID_CLIENT_EXTERN framing::FieldTable& getHeaders();
/** Get a non-modifyable reference to the message headers. */
QPID_CLIENT_EXTERN const framing::FieldTable& getHeaders() const;
// FIXME aconway 2009-04-17: does this need to be in public API?
///@internal
QPID_CLIENT_EXTERN const framing::SequenceNumber& getId() const;
private:
MessageImpl* impl;
friend class MessageImpl; // Helper template for implementation
};
}}
#endif /*!QPID_CLIENT_MESSAGE_H*/
|