summaryrefslogtreecommitdiff
path: root/cpp/lib/broker/BrokerMessageBase.h
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-02-02 22:03:10 +0000
committerAlan Conway <aconway@apache.org>2007-02-02 22:03:10 +0000
commitb5c270f10496f522ef6a03a8fa60f85d55c9187d (patch)
tree714e7abf7ba591d00232d821440e51461175cb9e /cpp/lib/broker/BrokerMessageBase.h
parent750f272ac99e8c830807affb3ae68ab0beeca63f (diff)
downloadqpid-python-b5c270f10496f522ef6a03a8fa60f85d55c9187d.tar.gz
* cpp/lib/common/framing/MethodContext.h: Reduced MethodContext to
ChannelAdapter and Method Body. Request ID comes from body, ChannelAdapter is used to send frames, not OutputHandler. * cpp/lib/common/framing/ChannelAdapter.h,.cpp: Removed context member. Context is per-method not per-channel. * cpp/lib/broker/*: Replace direct use of OutputHandler and ChannelId with MethodContext (for responses) or ChannelAdapter (for requests.) Use context request-ID to construct responses, send all bodies via ChannelAdapter. * cpp/lib/broker/BrokerAdapter.cpp: Link broker::Channel to BrokerAdapter. * cpp/lib/broker/*: Remove unnecessary ProtocolVersion parameters. Fix bogus signatures: ProtocolVersion* -> const ProtocolVersion& * Cosmetic changes, many files: - fixed indentation, broke long lines. - removed unnecessary qpid:: prefixes. * broker/BrokerAdapter,BrokerChannel: Merged BrokerAdapter into broker::channel. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@502767 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/lib/broker/BrokerMessageBase.h')
-rw-r--r--cpp/lib/broker/BrokerMessageBase.h242
1 files changed, 122 insertions, 120 deletions
diff --git a/cpp/lib/broker/BrokerMessageBase.h b/cpp/lib/broker/BrokerMessageBase.h
index 53fcf66aac..9a5b136ada 100644
--- a/cpp/lib/broker/BrokerMessageBase.h
+++ b/cpp/lib/broker/BrokerMessageBase.h
@@ -24,146 +24,148 @@
#include "AMQContentBody.h"
#include "AMQHeaderBody.h"
+#include "AMQMethodBody.h"
#include "Content.h"
+#include "framing/amqp_types.h"
#include <string>
#include <boost/shared_ptr.hpp>
namespace qpid {
- namespace framing {
- class OutputHandler;
- class ProtocolVersion;
- class BasicHeaderProperties;
- }
+namespace framing {
+class MethodContext;
+class ChannelAdapter;
+class BasicHeaderProperties;
+}
- namespace broker {
-
- class MessageStore;
- class ConnectionToken;
-
- /**
- * Base class for all types of internal broker messages
- * abstracting away the operations
- * TODO; AMS: for the moment this is mostly a placeholder
- */
- class Message{
- std::string exchange;
- std::string routingKey;
- const bool mandatory;
- const bool immediate;
- u_int64_t persistenceId;
-
- bool redelivered;
+namespace broker {
- public:
- typedef boost::shared_ptr<Message> shared_ptr;
+class MessageStore;
+class ConnectionToken;
- Message(const std::string& _exchange, const std::string& _routingKey,
- bool _mandatory, bool _immediate) :
- exchange(_exchange),
- routingKey(_routingKey),
- mandatory(_mandatory),
- immediate(_immediate),
- persistenceId(0),
- redelivered(false)
- {}
-
- Message() :
- mandatory(false),
- immediate(false),
- persistenceId(0),
- redelivered(false)
- {}
-
- virtual ~Message() {};
+/**
+ * Base class for all types of internal broker messages
+ * abstracting away the operations
+ * TODO; AMS: for the moment this is mostly a placeholder
+ */
+class Message{
+ std::string exchange;
+ std::string routingKey;
+ const bool mandatory;
+ const bool immediate;
+ u_int64_t persistenceId;
+ bool redelivered;
+ framing::AMQMethodBody::shared_ptr respondTo;
+
+ public:
+ typedef boost::shared_ptr<Message> shared_ptr;
+
+ Message(const std::string& _exchange, const std::string& _routingKey,
+ bool _mandatory, bool _immediate,
+ framing::AMQMethodBody::shared_ptr respondTo_) :
+ exchange(_exchange),
+ routingKey(_routingKey),
+ mandatory(_mandatory),
+ immediate(_immediate),
+ persistenceId(0),
+ redelivered(false),
+ respondTo(respondTo_)
+ {}
- // Accessors
- const std::string& getRoutingKey() const { return routingKey; }
- const std::string& getExchange() const { return exchange; }
- u_int64_t getPersistenceId() const { return persistenceId; }
- bool getRedelivered() const { return redelivered; }
+ Message() :
+ mandatory(false),
+ immediate(false),
+ persistenceId(0),
+ redelivered(false)
+ {}
+
+ virtual ~Message() {};
- void setRouting(const std::string& _exchange, const std::string& _routingKey)
- { exchange = _exchange; routingKey = _routingKey; }
- void setPersistenceId(u_int64_t _persistenceId) { persistenceId = _persistenceId; } // XXXX: Only used in tests?
- void redeliver() { redelivered = true; }
-
- /**
- * Used to deliver the message from the queue
- */
- virtual void deliver(qpid::framing::OutputHandler* out,
- int channel,
+ // Accessors
+ const std::string& getRoutingKey() const { return routingKey; }
+ const std::string& getExchange() const { return exchange; }
+ u_int64_t getPersistenceId() const { return persistenceId; }
+ bool getRedelivered() const { return redelivered; }
+ framing::AMQMethodBody::shared_ptr getRespondTo() const {
+ return respondTo;
+ }
+
+ void setRouting(const std::string& _exchange, const std::string& _routingKey)
+ { exchange = _exchange; routingKey = _routingKey; }
+ void setPersistenceId(u_int64_t _persistenceId) { persistenceId = _persistenceId; } // XXXX: Only used in tests?
+ void redeliver() { redelivered = true; }
+
+ /**
+ * Used to deliver the message from the queue
+ */
+ virtual void deliver(framing::ChannelAdapter& channel,
const std::string& consumerTag,
u_int64_t deliveryTag,
- u_int32_t framesize,
- qpid::framing::ProtocolVersion* version) = 0;
- /**
- * Used to return a message in response to a get from a queue
- */
- virtual void sendGetOk(qpid::framing::OutputHandler* out,
- int channel,
+ u_int32_t framesize) = 0;
+ /**
+ * Used to return a message in response to a get from a queue
+ */
+ virtual void sendGetOk(const framing::MethodContext& context,
u_int32_t messageCount,
u_int64_t deliveryTag,
- u_int32_t framesize,
- qpid::framing::ProtocolVersion* version) = 0;
+ u_int32_t framesize) = 0;
- virtual bool isComplete() = 0;
+ virtual bool isComplete() = 0;
- virtual u_int64_t contentSize() const = 0;
- virtual qpid::framing::BasicHeaderProperties* getHeaderProperties() = 0;
- virtual bool isPersistent() = 0;
- virtual const ConnectionToken* const getPublisher() = 0;
-
- virtual void encode(qpid::framing::Buffer& /*buffer*/) {}; // XXXX: Only used in tests?
- virtual void encodeHeader(qpid::framing::Buffer& /*buffer*/) {}; // XXXX: Only used in tests?
-
- /**
- * @returns the size of the buffer needed to encode this
- * message in its entirety
- *
- * XXXX: Only used in tests?
- */
- virtual u_int32_t encodedSize() = 0;
- /**
- * @returns the size of the buffer needed to encode the
- * 'header' of this message (not just the header frame,
- * but other meta data e.g.routing key and exchange)
- *
- * XXXX: Only used in tests?
- */
- virtual u_int32_t encodedHeaderSize() = 0;
- /**
- * @returns the size of the buffer needed to encode the
- * (possibly partial) content held by this message
- */
- virtual u_int32_t encodedContentSize() = 0;
- /**
- * If headers have been received, returns the expected
- * content size else returns 0.
- */
- virtual u_int64_t expectedContentSize() = 0;
+ virtual u_int64_t contentSize() const = 0;
+ virtual framing::BasicHeaderProperties* getHeaderProperties() = 0;
+ virtual bool isPersistent() = 0;
+ virtual const ConnectionToken* const getPublisher() = 0;
+
+ virtual void encode(framing::Buffer& /*buffer*/) {}; // XXXX: Only used in tests?
+ virtual void encodeHeader(framing::Buffer& /*buffer*/) {}; // XXXX: Only used in tests?
+
+ /**
+ * @returns the size of the buffer needed to encode this
+ * message in its entirety
+ *
+ * XXXX: Only used in tests?
+ */
+ virtual u_int32_t encodedSize() = 0;
+ /**
+ * @returns the size of the buffer needed to encode the
+ * 'header' of this message (not just the header frame,
+ * but other meta data e.g.routing key and exchange)
+ *
+ * XXXX: Only used in tests?
+ */
+ virtual u_int32_t encodedHeaderSize() = 0;
+ /**
+ * @returns the size of the buffer needed to encode the
+ * (possibly partial) content held by this message
+ */
+ virtual u_int32_t encodedContentSize() = 0;
+ /**
+ * If headers have been received, returns the expected
+ * content size else returns 0.
+ */
+ virtual u_int64_t expectedContentSize() = 0;
- // TODO: AMS 29/1/2007 Don't think these are really part of base class
+ // TODO: AMS 29/1/2007 Don't think these are really part of base class
- /**
- * Sets the 'content' implementation of this message (the
- * message controls the lifecycle of the content instance
- * it uses).
- */
- virtual void setContent(std::auto_ptr<Content>& /*content*/) {};
- virtual void setHeader(qpid::framing::AMQHeaderBody::shared_ptr /*header*/) {};
- virtual void addContent(qpid::framing::AMQContentBody::shared_ptr /*data*/) {};
- /**
- * Releases the in-memory content data held by this
- * message. Must pass in a store from which the data can
- * be reloaded.
- */
- virtual void releaseContent(MessageStore* /*store*/) {};
- };
-
- }
-}
+ /**
+ * Sets the 'content' implementation of this message (the
+ * message controls the lifecycle of the content instance
+ * it uses).
+ */
+ virtual void setContent(std::auto_ptr<Content>& /*content*/) {};
+ virtual void setHeader(framing::AMQHeaderBody::shared_ptr /*header*/) {};
+ virtual void addContent(framing::AMQContentBody::shared_ptr /*data*/) {};
+ /**
+ * Releases the in-memory content data held by this
+ * message. Must pass in a store from which the data can
+ * be reloaded.
+ */
+ virtual void releaseContent(MessageStore* /*store*/) {};
+};
+
+}}
#endif /*!_broker_BrokerMessage_h*/