diff options
| author | Gordon Sim <gsim@apache.org> | 2007-07-09 10:07:26 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2007-07-09 10:07:26 +0000 |
| commit | c4bf499790c30e0c98dd560c50c64c8a27fd9b89 (patch) | |
| tree | c1f439bb86e32027c1aea5ec4e78f291737e8230 /cpp/src/qpid/broker/HandlerImpl.h | |
| parent | 32fe78d370e0572a5ed21ff3e84f668d8a2f2a49 (diff) | |
| download | qpid-python-c4bf499790c30e0c98dd560c50c64c8a27fd9b89.tar.gz | |
refactoring:
* separated out the connection level method handling from semantic level (session/channel level should also be separated)
* reduce coupling between Connection and Channel
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@554590 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/HandlerImpl.h')
| -rw-r--r-- | cpp/src/qpid/broker/HandlerImpl.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/cpp/src/qpid/broker/HandlerImpl.h b/cpp/src/qpid/broker/HandlerImpl.h index 338ebca4b7..008be10867 100644 --- a/cpp/src/qpid/broker/HandlerImpl.h +++ b/cpp/src/qpid/broker/HandlerImpl.h @@ -19,6 +19,7 @@ * */ +#include "Broker.h" #include "BrokerChannel.h" #include "qpid/framing/AMQP_ClientProxy.h" @@ -30,8 +31,7 @@ class AMQP_ClientProxy; namespace broker { -class Broker; -class Channel; + //class Channel; class Connection; /** @@ -47,6 +47,28 @@ struct CoreRefs Connection& connection; Broker& broker; framing::AMQP_ClientProxy proxy; + + /** + * Get named queue, never returns 0. + * @return: named queue or default queue for channel if name="" + * @exception: ChannelException if no queue of that name is found. + * @exception: ConnectionException if name="" and channel has no default. + */ + Queue::shared_ptr getQueue(const string& name) { + //Note: this can be removed soon as the default queue for channels is scrapped in 0-10 + Queue::shared_ptr queue; + if (name.empty()) { + queue = channel.getDefaultQueue(); + if (!queue) throw ConnectionException( 530, "Queue must be specified or previously declared" ); + } else { + queue = broker.getQueues().find(name); + if (queue == 0) { + throw ChannelException( 404, "Queue not found: " + name); + } + } + return queue; + } + }; |
