2014-08-27 03:05:39 +08:00
|
|
|
#ifndef QAMQPMESSAGE_H
|
|
|
|
|
#define QAMQPMESSAGE_H
|
2014-05-29 01:52:27 +08:00
|
|
|
|
2014-05-29 00:25:28 +08:00
|
|
|
#include <QByteArray>
|
|
|
|
|
#include <QHash>
|
2014-06-19 22:00:52 +08:00
|
|
|
#include <QSharedDataPointer>
|
2014-08-26 21:57:08 +08:00
|
|
|
#include <QVariant>
|
2014-05-29 00:25:28 +08:00
|
|
|
|
2014-08-27 03:05:39 +08:00
|
|
|
#include "qamqpglobal.h"
|
2014-05-29 03:33:15 +08:00
|
|
|
|
2014-05-29 00:25:28 +08:00
|
|
|
namespace QAMQP
|
|
|
|
|
{
|
|
|
|
|
|
2014-06-06 03:34:08 +08:00
|
|
|
class MessagePrivate;
|
|
|
|
|
class QAMQP_EXPORT Message
|
2014-05-29 00:25:28 +08:00
|
|
|
{
|
2014-06-06 03:34:08 +08:00
|
|
|
public:
|
2014-05-29 00:25:28 +08:00
|
|
|
Message();
|
2014-06-06 03:34:08 +08:00
|
|
|
Message(const Message &other);
|
|
|
|
|
Message &operator=(const Message &other);
|
|
|
|
|
~Message();
|
2014-05-29 00:25:28 +08:00
|
|
|
|
2014-07-22 03:17:04 +08:00
|
|
|
enum Property {
|
|
|
|
|
ContentType = AMQP_BASIC_CONTENT_TYPE_FLAG,
|
|
|
|
|
ContentEncoding = AMQP_BASIC_CONTENT_ENCODING_FLAG,
|
|
|
|
|
Headers = AMQP_BASIC_HEADERS_FLAG,
|
|
|
|
|
DeliveryMode = AMQP_BASIC_DELIVERY_MODE_FLAG,
|
|
|
|
|
Priority = AMQP_BASIC_PRIORITY_FLAG,
|
|
|
|
|
CorrelationId = AMQP_BASIC_CORRELATION_ID_FLAG,
|
|
|
|
|
ReplyTo = AMQP_BASIC_REPLY_TO_FLAG,
|
|
|
|
|
Expiration = AMQP_BASIC_EXPIRATION_FLAG,
|
|
|
|
|
MessageId = AMQP_BASIC_MESSAGE_ID_FLAG,
|
|
|
|
|
Timestamp = AMQP_BASIC_TIMESTAMP_FLAG,
|
|
|
|
|
Type = AMQP_BASIC_TYPE_FLAG,
|
|
|
|
|
UserId = AMQP_BASIC_USER_ID_FLAG,
|
|
|
|
|
AppId = AMQP_BASIC_APP_ID_FLAG,
|
|
|
|
|
ClusterID = AMQP_BASIC_CLUSTER_ID_FLAG
|
|
|
|
|
};
|
|
|
|
|
Q_DECLARE_FLAGS(Properties, Property)
|
2014-08-26 21:57:08 +08:00
|
|
|
typedef QHash<Property, QVariant> PropertyHash;
|
2014-07-22 03:17:04 +08:00
|
|
|
|
|
|
|
|
bool hasProperty(Property property) const;
|
|
|
|
|
void setProperty(Property property, const QVariant &value);
|
2014-08-26 21:57:08 +08:00
|
|
|
QVariant property(Property property, const QVariant &defaultValue = QVariant()) const;
|
2014-07-22 03:17:04 +08:00
|
|
|
|
2014-07-22 04:25:21 +08:00
|
|
|
bool hasHeader(const QString &header) const;
|
|
|
|
|
void setHeader(const QString &header, const QVariant &value);
|
2014-08-26 21:57:08 +08:00
|
|
|
QVariant header(const QString &header, const QVariant &defaultValue = QVariant()) const;
|
2014-07-22 04:25:21 +08:00
|
|
|
|
2014-06-19 22:00:52 +08:00
|
|
|
bool isValid() const;
|
2014-07-22 04:25:21 +08:00
|
|
|
bool isRedelivered() const;
|
2014-06-06 03:34:08 +08:00
|
|
|
qlonglong deliveryTag() const;
|
|
|
|
|
QString exchangeName() const;
|
|
|
|
|
QString routingKey() const;
|
|
|
|
|
QByteArray payload() const;
|
|
|
|
|
|
|
|
|
|
private:
|
2014-06-19 22:00:52 +08:00
|
|
|
QSharedDataPointer<MessagePrivate> d;
|
2014-06-06 03:34:08 +08:00
|
|
|
friend class QueuePrivate;
|
|
|
|
|
friend class Queue;
|
2014-05-29 00:25:28 +08:00
|
|
|
|
2014-06-06 03:34:08 +08:00
|
|
|
};
|
2014-05-29 01:52:27 +08:00
|
|
|
|
|
|
|
|
} // namespace QAMQP
|
2014-05-29 00:25:28 +08:00
|
|
|
|
2014-08-26 21:57:08 +08:00
|
|
|
Q_DECLARE_METATYPE(QAMQP::Message::PropertyHash)
|
|
|
|
|
|
2014-08-27 03:05:39 +08:00
|
|
|
#endif // QAMQPMESSAGE_H
|