diff options
author | Gordon Sim <gsim@apache.org> | 2006-12-13 09:22:07 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2006-12-13 09:22:07 +0000 |
commit | 39dd61bc66b531810160ef00de938846c27052c9 (patch) | |
tree | 17e773b91f7e5c98302a1e5d67fcc6398c67b2f0 | |
parent | a775c87d5e2c5a6e1f8205541378ab3e1a0a8089 (diff) | |
download | qpid-python-39dd61bc66b531810160ef00de938846c27052c9.tar.gz |
Added prepared() method to MessageStore interface.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@486555 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | cpp/lib/broker/MessageStore.h | 5 | ||||
-rw-r--r-- | cpp/lib/broker/MessageStoreModule.cpp | 5 | ||||
-rw-r--r-- | cpp/lib/broker/MessageStoreModule.h | 5 | ||||
-rw-r--r-- | cpp/lib/broker/NullMessageStore.cpp | 5 | ||||
-rw-r--r-- | cpp/lib/broker/NullMessageStore.h | 5 | ||||
-rw-r--r-- | cpp/lib/client/Connection.h | 26 |
6 files changed, 43 insertions, 8 deletions
diff --git a/cpp/lib/broker/MessageStore.h b/cpp/lib/broker/MessageStore.h index acbff82c35..938f807a67 100644 --- a/cpp/lib/broker/MessageStore.h +++ b/cpp/lib/broker/MessageStore.h @@ -117,6 +117,11 @@ namespace qpid { * place or null for 'local' transactions */ virtual void dequeue(TransactionContext* ctxt, Message* const msg, const Queue& queue, const std::string * const xid) = 0; + + /** + * Treat all enqueue/dequeues where this xid was specified as being prepared. + */ + virtual void prepared(const std::string * const xid) = 0; /** * Treat all enqueue/dequeues where this xid was specified as being committed. */ diff --git a/cpp/lib/broker/MessageStoreModule.cpp b/cpp/lib/broker/MessageStoreModule.cpp index 1952786014..ccc5501379 100644 --- a/cpp/lib/broker/MessageStoreModule.cpp +++ b/cpp/lib/broker/MessageStoreModule.cpp @@ -73,6 +73,11 @@ void MessageStoreModule::dequeue(TransactionContext* ctxt, Message* const msg, c store->dequeue(ctxt, msg, queue, xid); } +void MessageStoreModule::prepared(const string * const xid) +{ + store->prepared(xid); +} + void MessageStoreModule::committed(const string * const xid) { store->committed(xid); diff --git a/cpp/lib/broker/MessageStoreModule.h b/cpp/lib/broker/MessageStoreModule.h index fcff71bd35..c49e06efa1 100644 --- a/cpp/lib/broker/MessageStoreModule.h +++ b/cpp/lib/broker/MessageStoreModule.h @@ -45,8 +45,9 @@ namespace qpid { void loadContent(Message* const msg, std::string& data, u_int64_t offset, u_int32_t length); void enqueue(TransactionContext* ctxt, Message* const msg, const Queue& queue, const string * const xid); void dequeue(TransactionContext* ctxt, Message* const msg, const Queue& queue, const string * const xid); - void committed(const string * const xid); - void aborted(const string * const xid); + void prepared(const std::string * const xid); + void committed(const std::string * const xid); + void aborted(const std::string * const xid); std::auto_ptr<TransactionContext> begin(); void commit(TransactionContext* ctxt); void abort(TransactionContext* ctxt); diff --git a/cpp/lib/broker/NullMessageStore.cpp b/cpp/lib/broker/NullMessageStore.cpp index a8318a4bf7..571ca7566b 100644 --- a/cpp/lib/broker/NullMessageStore.cpp +++ b/cpp/lib/broker/NullMessageStore.cpp @@ -75,6 +75,11 @@ void NullMessageStore::dequeue(TransactionContext*, Message* const, const Queue& if (warn) std::cout << "WARNING: Can't dequeue message from '" << queue.getName() << "'. Persistence not enabled." << std::endl; } +void NullMessageStore::prepared(const string * const) +{ + if (warn) std::cout << "WARNING: Persistence not enabled." << std::endl; +} + void NullMessageStore::committed(const string * const) { if (warn) std::cout << "WARNING: Persistence not enabled." << std::endl; diff --git a/cpp/lib/broker/NullMessageStore.h b/cpp/lib/broker/NullMessageStore.h index 913d6b0a8d..ef2bea8fd6 100644 --- a/cpp/lib/broker/NullMessageStore.h +++ b/cpp/lib/broker/NullMessageStore.h @@ -44,8 +44,9 @@ namespace qpid { virtual void loadContent(Message* const msg, std::string& data, u_int64_t offset, u_int32_t length); virtual void enqueue(TransactionContext* ctxt, Message* const msg, const Queue& queue, const string * const xid); virtual void dequeue(TransactionContext* ctxt, Message* const msg, const Queue& queue, const string * const xid); - virtual void committed(const string * const xid); - virtual void aborted(const string * const xid); + virtual void prepared(const std::string * const xid); + virtual void committed(const std::string * const xid); + virtual void aborted(const std::string * const xid); virtual std::auto_ptr<TransactionContext> begin(); virtual void commit(TransactionContext* ctxt); virtual void abort(TransactionContext* ctxt); diff --git a/cpp/lib/client/Connection.h b/cpp/lib/client/Connection.h index 2da4eb50e3..aec4de0b37 100644 --- a/cpp/lib/client/Connection.h +++ b/cpp/lib/client/Connection.h @@ -42,7 +42,12 @@ namespace client { class Channel; -class Connection : public virtual qpid::framing::InputHandler, + /** + * Represents a connection to an AMQP broker. All communication is + * initiated by establishing a connection, then opening one or + * more channels over that connection. + */ + class Connection : public virtual qpid::framing::InputHandler, public virtual qpid::sys::TimeoutHandler, public virtual qpid::sys::ShutdownHandler, private virtual qpid::framing::BodyHandler{ @@ -59,7 +64,7 @@ class Connection : public virtual qpid::framing::InputHandler, qpid::framing::OutputHandler* out; ResponseHandler responses; volatile bool closed; - qpid::framing::ProtocolVersion version; + qpid::framing::ProtocolVersion version; void channelException(Channel* channel, qpid::framing::AMQMethodBody* body, QpidError& e); void error(int code, const std::string& msg, int classid = 0, int methodid = 0); @@ -72,9 +77,23 @@ class Connection : public virtual qpid::framing::InputHandler, virtual void handleHeartbeat(qpid::framing::AMQHeartbeatBody::shared_ptr body); public: - + /** + * Creates a connection object, but does not open the + * connection. + * + * @param debug turns on tracing for the connection + * (i.e. prints details of the frames sent and received to std + * out). Optional and defaults to false. + * + * @param max_frame_size the maximum frame size that the + * client will accept. Optional and defaults to 65536. + */ Connection(bool debug = false, u_int32_t max_frame_size = 65536); ~Connection(); + + /** + * + */ void open(const std::string& host, int port = 5672, const std::string& uid = "guest", const std::string& pwd = "guest", const std::string& virtualhost = "/"); @@ -101,7 +120,6 @@ class Connection : public virtual qpid::framing::InputHandler, inline u_int32_t getMaxFrameSize(){ return max_frame_size; } }; - } } |