From 9f6c3db207f27e91cb7e76f82f8257a9c5007719 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Tue, 18 Sep 2007 14:45:33 +0000 Subject: Added Dispatcher class (plus test). This converts incoming MessageTransfer framesets to Messages and pumps them to registered listeners. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@576935 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/ClientMessage.h | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'cpp/src/qpid/client/ClientMessage.h') diff --git a/cpp/src/qpid/client/ClientMessage.h b/cpp/src/qpid/client/ClientMessage.h index 5c4eb4e5aa..a573e17940 100644 --- a/cpp/src/qpid/client/ClientMessage.h +++ b/cpp/src/qpid/client/ClientMessage.h @@ -22,6 +22,8 @@ * */ #include +#include "qpid/client/Session.h" +#include "qpid/framing/MessageTransferBody.h" #include "qpid/framing/TransferContent.h" namespace qpid { @@ -40,12 +42,7 @@ public: std::string getDestination() const { - return destination; - } - - void setDestination(const std::string& dest) - { - destination = dest; + return method.getDestination(); } bool isRedelivered() const @@ -53,7 +50,8 @@ public: return hasDeliveryProperties() && getDeliveryProperties().getRedelivered(); } - void setRedelivered(bool redelivered) { + void setRedelivered(bool redelivered) + { getDeliveryProperties().setRedelivered(redelivered); } @@ -62,8 +60,25 @@ public: return getMessageProperties().getApplicationHeaders(); } + void acknowledge(Session& session, bool cumulative = true, bool send = true) const + { + session.execution().completed(id, cumulative, send); + } + + Message(const framing::FrameSet& frameset) : method(*frameset.as()), id(frameset.getId()) + { + populate(frameset); + } + + const framing::MessageTransferBody& getMethod() const + { + return method; + } + private: - std::string destination; + //method and id are only set for received messages: + const framing::MessageTransferBody method; + const framing::SequenceNumber id; }; }} -- cgit v1.2.1