diff options
Diffstat (limited to 'cpp/lib/client')
-rw-r--r-- | cpp/lib/client/ClientMessage.cpp | 22 | ||||
-rw-r--r-- | cpp/lib/client/ClientMessage.h | 54 |
2 files changed, 27 insertions, 49 deletions
diff --git a/cpp/lib/client/ClientMessage.cpp b/cpp/lib/client/ClientMessage.cpp index 3ad2d0b2f4..8edd0a474d 100644 --- a/cpp/lib/client/ClientMessage.cpp +++ b/cpp/lib/client/ClientMessage.cpp @@ -42,11 +42,11 @@ BasicHeaderProperties* Message::getHeaderProperties() const { return dynamic_cast<BasicHeaderProperties*>(header->getProperties()); } -const std::string& Message::getContentType() const { +std::string Message::getContentType() const { return getHeaderProperties()->getContentType(); } -const std::string& Message::getContentEncoding() const { +std::string Message::getContentEncoding() const { return getHeaderProperties()->getContentEncoding(); } @@ -62,19 +62,19 @@ uint8_t Message::getPriority() const { return getHeaderProperties()->getPriority(); } -const std::string& Message::getCorrelationId() const { +std::string Message::getCorrelationId() const { return getHeaderProperties()->getCorrelationId(); } -const std::string& Message::getReplyTo() const { +std::string Message::getReplyTo() const { return getHeaderProperties()->getReplyTo(); } -const std::string& Message::getExpiration() const { +std::string Message::getExpiration() const { return getHeaderProperties()->getExpiration(); } -const std::string& Message::getMessageId() const { +std::string Message::getMessageId() const { return getHeaderProperties()->getMessageId(); } @@ -82,19 +82,19 @@ uint64_t Message::getTimestamp() const { return getHeaderProperties()->getTimestamp(); } -const std::string& Message::getType() const { +std::string Message::getType() const { return getHeaderProperties()->getType(); } -const std::string& Message::getUserId() const { +std::string Message::getUserId() const { return getHeaderProperties()->getUserId(); } -const std::string& Message::getAppId() const { +std::string Message::getAppId() const { return getHeaderProperties()->getAppId(); } -const std::string& Message::getClusterId() const { +std::string Message::getClusterId() const { return getHeaderProperties()->getClusterId(); } @@ -110,7 +110,7 @@ void Message::setHeaders(const FieldTable& headers){ getHeaderProperties()->setHeaders(headers); } -void Message::setDeliveryMode(uint8_t mode){ +void Message::setDeliveryMode(DeliveryMode mode){ getHeaderProperties()->setDeliveryMode(mode); } diff --git a/cpp/lib/client/ClientMessage.h b/cpp/lib/client/ClientMessage.h index cb239ed4d6..c89eeb1a0d 100644 --- a/cpp/lib/client/ClientMessage.h +++ b/cpp/lib/client/ClientMessage.h @@ -46,56 +46,34 @@ class Message { Message(qpid::framing::AMQHeaderBody::shared_ptr& header); public: + enum DeliveryMode { DURABLE=1, NON_DURABLE=2 }; Message(const std::string& data=std::string()); ~Message(); - - /** - * Allows the application to access the content of messages - * received. - * - * @return a string representing the data of the message - */ - std::string getData() const { return data; } - - /** - * Allows the application to set the content of messages to be - * sent. - * - * @param data a string representing the data of the message - */ - void setData(const std::string& _data); - - /** - * @return true if this message was delivered previously (to - * any consumer) but was not acknowledged. - */ - bool isRedelivered(){ return redelivered; } - void setRedelivered(bool _redelivered){ redelivered = _redelivered; } + std::string getData() const { return data; } + bool isRedelivered() const { return redelivered; } uint64_t getDeliveryTag() const; - - const std::string& getContentType() const; - const std::string& getContentEncoding() const; + std::string getContentType() const; + std::string getContentEncoding() const; qpid::framing::FieldTable& getHeaders() const; uint8_t getDeliveryMode() const; uint8_t getPriority() const; - const std::string& getCorrelationId() const; - const std::string& getReplyTo() const; - const std::string& getExpiration() const; - const std::string& getMessageId() const; + std::string getCorrelationId() const; + std::string getReplyTo() const; + std::string getExpiration() const; + std::string getMessageId() const; uint64_t getTimestamp() const; - const std::string& getType() const; - const std::string& getUserId() const; - const std::string& getAppId() const; - const std::string& getClusterId() const; + std::string getType() const; + std::string getUserId() const; + std::string getAppId() const; + std::string getClusterId() const; + void setData(const std::string& _data); + void setRedelivered(bool _redelivered){ redelivered = _redelivered; } void setContentType(const std::string& type); void setContentEncoding(const std::string& encoding); void setHeaders(const qpid::framing::FieldTable& headers); - /** - * Sets the delivery mode. 1 = non-durable, 2 = durable. - */ - void setDeliveryMode(uint8_t mode); + void setDeliveryMode(DeliveryMode mode); void setPriority(uint8_t priority); void setCorrelationId(const std::string& correlationId); void setReplyTo(const std::string& replyTo); |