summaryrefslogtreecommitdiff
path: root/cpp/lib/broker/BrokerMessageBase.h
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-01-31 23:28:38 +0000
committerAlan Conway <aconway@apache.org>2007-01-31 23:28:38 +0000
commitd71bc6e3f85c90d5f22d186aceadd1894c55383b (patch)
treed4210b428cd57c1cea4a86db175ac44566bf84dd /cpp/lib/broker/BrokerMessageBase.h
parentee4d5ffba8167348ea2751202c6065e8de0fc92c (diff)
downloadqpid-python-d71bc6e3f85c90d5f22d186aceadd1894c55383b.tar.gz
From Andrew Stitcher <astitcher@redhat.com>
r723@fuschia: andrew | 2007-01-12 00:35:16 +0000 Branch for my work on Qpid.0-9 r724@fuschia: andrew | 2007-01-12 00:59:28 +0000 Added in empty implementation of handler class for protocol Message class r768@fuschia: andrew | 2007-01-17 01:25:16 +0000 * Added Test for new MessageHandlerImpl (but no actual tests yet) * Filled in lots of the blanks in the MessageHandlerImpl with code stolen from the BasicHandlerImpl r800@fuschia: andrew | 2007-01-17 17:34:13 +0000 Updated to latest upstream changes r840@fuschia: andrew | 2007-01-19 00:31:59 +0000 Fixed merge errors r841@fuschia: andrew | 2007-01-19 00:47:29 +0000 Another merge problem fixed r878@fuschia: andrew | 2007-01-24 11:27:48 +0000 Started work on the Message class handler implementation r976@fuschia: andrew | 2007-01-30 17:05:05 +0000 Working again after broker Message refactor r980@fuschia: andrew | 2007-01-30 18:39:18 +0000 Fix for extra parameter to transfer r992@fuschia: andrew | 2007-01-31 18:29:57 +0000 Checkpoint of work on broker MessageMessage r1001@fuschia: andrew | 2007-01-31 22:02:27 +0000 MessageMessage work now compiles git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@502038 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/lib/broker/BrokerMessageBase.h')
-rw-r--r--cpp/lib/broker/BrokerMessageBase.h181
1 files changed, 41 insertions, 140 deletions
diff --git a/cpp/lib/broker/BrokerMessageBase.h b/cpp/lib/broker/BrokerMessageBase.h
index e0139519ae..53fcf66aac 100644
--- a/cpp/lib/broker/BrokerMessageBase.h
+++ b/cpp/lib/broker/BrokerMessageBase.h
@@ -48,38 +48,73 @@ namespace qpid {
* 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;
public:
typedef boost::shared_ptr<Message> shared_ptr;
+ 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() {};
+ // 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; }
+
+ 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,
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 messageCount,
u_int64_t deliveryTag,
u_int32_t framesize,
qpid::framing::ProtocolVersion* version) = 0;
- virtual void redeliver() = 0;
virtual bool isComplete() = 0;
virtual u_int64_t contentSize() const = 0;
virtual qpid::framing::BasicHeaderProperties* getHeaderProperties() = 0;
virtual bool isPersistent() = 0;
- virtual const std::string& getRoutingKey() const = 0;
virtual const ConnectionToken* const getPublisher() = 0;
- virtual u_int64_t getPersistenceId() const = 0; // XXXX: Only used in tests?
- virtual const std::string& getExchange() const = 0; // XXXX: Only used in tests?
- virtual void setPersistenceId(u_int64_t /*persistenceId*/) {}; // XXXX: Only used in tests?
-
virtual void encode(qpid::framing::Buffer& /*buffer*/) {}; // XXXX: Only used in tests?
virtual void encodeHeader(qpid::framing::Buffer& /*buffer*/) {}; // XXXX: Only used in tests?
@@ -108,12 +143,6 @@ namespace qpid {
* content size else returns 0.
*/
virtual u_int64_t expectedContentSize() = 0;
- /**
- * 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*/) {};
// TODO: AMS 29/1/2007 Don't think these are really part of base class
@@ -125,140 +154,12 @@ namespace qpid {
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*/) {};
- };
-
- }
-}
-
-
-#endif /*!_broker_BrokerMessage_h*/
-#ifndef _broker_BrokerMessageBase_h
-#define _broker_BrokerMessageBase_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 "AMQContentBody.h"
-#include "AMQHeaderBody.h"
-#include "Content.h"
-
-#include <string>
-#include <boost/shared_ptr.hpp>
-
-namespace qpid {
-
- namespace framing {
- class OutputHandler;
- class ProtocolVersion;
- 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{
-
- public:
- typedef boost::shared_ptr<Message> shared_ptr;
-
- virtual ~Message() {};
-
- virtual void deliver(qpid::framing::OutputHandler* out,
- int channel,
- const std::string& consumerTag,
- u_int64_t deliveryTag,
- u_int32_t framesize,
- qpid::framing::ProtocolVersion* version) = 0;
- virtual void sendGetOk(qpid::framing::OutputHandler* out,
- int channel,
- u_int32_t messageCount,
- u_int64_t deliveryTag,
- u_int32_t framesize,
- qpid::framing::ProtocolVersion* version) = 0;
- virtual void redeliver() = 0;
-
- virtual bool isComplete() = 0;
-
- virtual u_int64_t contentSize() const = 0;
- virtual qpid::framing::BasicHeaderProperties* getHeaderProperties() = 0;
- virtual bool isPersistent() = 0;
- virtual const std::string& getRoutingKey() const = 0;
- virtual const ConnectionToken* const getPublisher() = 0;
- virtual u_int64_t getPersistenceId() const = 0; // XXXX: Only used in tests?
- virtual const std::string& getExchange() const = 0; // XXXX: Only used in tests?
-
- virtual void setPersistenceId(u_int64_t /*persistenceId*/) {}; // XXXX: Only used in tests?
-
- 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;
/**
* 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*/) {};
-
- // 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*/) {};
};
}