From bb2883b9f5cfad0e028a9849ed91e36418a2d0ff Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Tue, 21 Aug 2007 15:51:41 +0000 Subject: Refresh of transitional xml to more closely reflect latest specification Initial execution-result support (not yet handled on c++ client) Generation is now all done through the ruby code (it is a little slower at present I'm afraid, will try to speed it up over the next weeks) git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@568174 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/ClientChannel.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'cpp/src/qpid/client/ClientChannel.cpp') diff --git a/cpp/src/qpid/client/ClientChannel.cpp b/cpp/src/qpid/client/ClientChannel.cpp index aa73e83328..d1cc4734eb 100644 --- a/cpp/src/qpid/client/ClientChannel.cpp +++ b/cpp/src/qpid/client/ClientChannel.cpp @@ -20,6 +20,7 @@ */ #include "qpid/log/Statement.h" #include +#include #include "ClientChannel.h" #include "qpid/sys/Monitor.h" #include "ClientMessage.h" @@ -54,7 +55,8 @@ class ScopedSync }; Channel::Channel(bool _transactional, u_int16_t _prefetch) : - prefetch(_prefetch), transactional(_transactional), running(false) + prefetch(_prefetch), transactional(_transactional), running(false), + uniqueId(true)/*could eventually be the session id*/, nameCounter(0) { } @@ -103,20 +105,22 @@ void Channel::deleteExchange(Exchange& exchange, bool synch){ } void Channel::declareQueue(Queue& queue, bool synch){ + if (queue.getName().empty()) { + stringstream uniqueName; + uniqueName << uniqueId << "-queue-" << ++nameCounter; + queue.setName(uniqueName.str()); + } + FieldTable args; ScopedSync s(*session, synch); - Response r = session->queueDeclare(0, queue.getName(), empty, false/*passive*/, queue.isDurable(), - queue.isExclusive(), queue.isAutoDelete(), !synch, args); + session->queueDeclare(0, queue.getName(), empty, false/*passive*/, queue.isDurable(), + queue.isExclusive(), queue.isAutoDelete(), args); - if(synch) { - if(queue.getName().length() == 0) - queue.setName(r.as().getQueue()); - } } void Channel::deleteQueue(Queue& queue, bool ifunused, bool ifempty, bool synch){ ScopedSync s(*session, synch); - session->queueDelete(0, queue.getName(), ifunused, ifempty, !synch); + session->queueDelete(0, queue.getName(), ifunused, ifempty); } void Channel::bind(const Exchange& exchange, const Queue& queue, const std::string& key, const FieldTable& args, bool synch){ @@ -168,7 +172,7 @@ void Channel::cancel(const std::string& tag, bool synch) { consumers.erase(i); } ScopedSync s(*session, synch); - session->basicCancel(tag, !synch); + session->basicCancel(tag); } bool Channel::get(Message& msg, const Queue& queue, AckMode ackMode) { -- cgit v1.2.1