summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/cluster/DumpClient.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-11-12 17:15:20 +0000
committerAlan Conway <aconway@apache.org>2008-11-12 17:15:20 +0000
commitc99d4d45ead8020517838b99e2106887701b17d7 (patch)
tree66559a3df444de8a4cb52ffbead0123dd2325d69 /cpp/src/qpid/cluster/DumpClient.cpp
parent1a18c1798833e7201177e786afa0d05412c4f53b (diff)
downloadqpid-python-c99d4d45ead8020517838b99e2106887701b17d7.tar.gz
Cluster replicates queues/exchanges with same encode/decode functions as the store.
Removed un-necessary heap allocation in QPID_LOG statements. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@713425 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/DumpClient.cpp')
-rw-r--r--cpp/src/qpid/cluster/DumpClient.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/cpp/src/qpid/cluster/DumpClient.cpp b/cpp/src/qpid/cluster/DumpClient.cpp
index 18db83ba87..3a4f217721 100644
--- a/cpp/src/qpid/cluster/DumpClient.cpp
+++ b/cpp/src/qpid/cluster/DumpClient.cpp
@@ -133,14 +133,20 @@ void DumpClient::run() {
delete this;
}
+namespace {
+template <class T> std::string encode(const T& t) {
+ std::string encoded;
+ encoded.resize(t.encodedSize());
+ framing::Buffer buf(const_cast<char*>(encoded.data()), encoded.size());
+ t.encode(buf);
+ return encoded;
+}
+} // namespace
+
void DumpClient::dumpExchange(const boost::shared_ptr<Exchange>& ex) {
- session.exchangeDeclare(
- ex->getName(), ex->getType(),
- ex->getAlternate() ? ex->getAlternate()->getName() : std::string(),
- arg::passive=false,
- arg::durable=ex->isDurable(),
- arg::autoDelete=false,
- arg::arguments=ex->getArgs());
+ QPID_LOG(debug, dumperId << " dumping exchange " << ex->getName());
+ ClusterConnectionProxy proxy(session);
+ proxy.exchange(encode(*ex));
}
/** Bind a queue to the dump exchange and dump messges to it
@@ -181,14 +187,9 @@ class MessageDumper {
void DumpClient::dumpQueue(const boost::shared_ptr<Queue>& q) {
- session.queueDeclare(
- q->getName(),
- q->getAlternateExchange() ? q->getAlternateExchange()->getName() : std::string(),
- arg::passive=false,
- arg::durable=q->isDurable(),
- arg::exclusive=q->hasExclusiveConsumer(),
- arg::autoDelete=q->isAutoDelete(),
- arg::arguments=q->getSettings());
+ QPID_LOG(debug, dumperId << " dumping queue " << q->getName());
+ ClusterConnectionProxy proxy(session);
+ proxy.queue(encode(*q));
MessageDumper dumper(q->getName(), session);
q->eachMessage(boost::bind(&MessageDumper::dumpQueuedMessage, &dumper, _1));
q->eachBinding(boost::bind(&DumpClient::dumpBinding, this, q->getName(), _1));