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 +++++++++++++--------- cpp/src/qpid/client/ClientChannel.h | 5 ++++- cpp/src/qpid/client/Connection.h | 2 +- cpp/src/qpid/client/ExecutionHandler.cpp | 22 +++++++++++++++++++++- cpp/src/qpid/client/ExecutionHandler.h | 5 ++++- 5 files changed, 43 insertions(+), 13 deletions(-) (limited to 'cpp/src/qpid/client') 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) { diff --git a/cpp/src/qpid/client/ClientChannel.h b/cpp/src/qpid/client/ClientChannel.h index 98e04db109..d73addc950 100644 --- a/cpp/src/qpid/client/ClientChannel.h +++ b/cpp/src/qpid/client/ClientChannel.h @@ -24,11 +24,12 @@ #include #include #include "qpid/framing/amqp_framing.h" +#include "qpid/framing/Uuid.h" #include "ClientExchange.h" #include "ClientMessage.h" #include "ClientQueue.h" #include "ConnectionImpl.h" -#include "Session.h" +#include "qpid/client/Session.h" #include "qpid/Exception.h" #include "qpid/sys/Mutex.h" #include "qpid/sys/Runnable.h" @@ -83,6 +84,8 @@ class Channel : private sys::Runnable SessionCore::shared_ptr sessionCore; framing::ChannelId channelId; BlockingQueue gets; + framing::Uuid uniqueId; + uint32_t nameCounter; void stop(); diff --git a/cpp/src/qpid/client/Connection.h b/cpp/src/qpid/client/Connection.h index e41ab363b5..e309b5c63e 100644 --- a/cpp/src/qpid/client/Connection.h +++ b/cpp/src/qpid/client/Connection.h @@ -26,7 +26,7 @@ #include "qpid/QpidError.h" #include "ClientChannel.h" #include "ConnectionImpl.h" -#include "Session.h" +#include "qpid/client/Session.h" #include "qpid/framing/AMQP_HighestVersion.h" diff --git a/cpp/src/qpid/client/ExecutionHandler.cpp b/cpp/src/qpid/client/ExecutionHandler.cpp index 6ee6429b6b..6c2600d00b 100644 --- a/cpp/src/qpid/client/ExecutionHandler.cpp +++ b/cpp/src/qpid/client/ExecutionHandler.cpp @@ -78,7 +78,7 @@ void ExecutionHandler::handle(AMQFrame& frame) } } -void ExecutionHandler::complete(uint32_t cumulative, SequenceNumberSet range) +void ExecutionHandler::complete(uint32_t cumulative, const SequenceNumberSet& range) { SequenceNumber mark(cumulative); if (outgoing.lwm < mark) { @@ -101,6 +101,26 @@ void ExecutionHandler::flush() incoming.lwm = incoming.hwm; } +void ExecutionHandler::noop() +{ + //do nothing +} + +void ExecutionHandler::result(uint32_t /*command*/, const std::string& /*data*/) +{ + //TODO: need to signal the result to the appropriate listener +} + +void ExecutionHandler::sync() +{ + //TODO: implement (the application is in charge of completion of + //some commands, so need to track completion for them). + + //This shouldn't ever need to be called by the server (in my + //opinion) as the server never needs to synchronise with the + //clients execution +} + void ExecutionHandler::sendFlush() { AMQFrame frame(version, 0, ExecutionFlushBody()); diff --git a/cpp/src/qpid/client/ExecutionHandler.h b/cpp/src/qpid/client/ExecutionHandler.h index 21613df779..b409d5df7b 100644 --- a/cpp/src/qpid/client/ExecutionHandler.h +++ b/cpp/src/qpid/client/ExecutionHandler.h @@ -45,8 +45,11 @@ class ExecutionHandler : framing::ProtocolVersion version; uint64_t maxFrameSize; - void complete(uint32_t mark, framing::SequenceNumberSet range); + void complete(uint32_t mark, const framing::SequenceNumberSet& range); void flush(); + void noop(); + void result(uint32_t command, const std::string& data); + void sync(); public: BlockingQueue received; -- cgit v1.2.1