Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 702380 Details for
Bug 912519
broker ignores if_empty and if_unused flags when deleting queues
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Add checkDeleteQueue method to broker
bz-903126.diff1 (text/plain), 2.84 KB, created by
Ernie
on 2013-02-25 14:47:19 UTC
(
hide
)
Description:
Add checkDeleteQueue method to broker
Filename:
MIME Type:
Creator:
Ernie
Created:
2013-02-25 14:47:19 UTC
Size:
2.84 KB
patch
obsolete
>Index: qpid/cpp/src/qpid/broker/Broker.cpp >=================================================================== >--- qpid/cpp/src/qpid/broker/Broker.cpp (revision 1447816) >+++ qpid/cpp/src/qpid/broker/Broker.cpp (working copy) >@@ -623,6 +623,10 @@ > const std::string SRC_IS_LOCAL("srcIsLocal"); > const std::string DYNAMIC("dynamic"); > const std::string SYNC("sync"); >+ >+// parameters for deleting a Queue object >+const std::string IF_EMPTY("if_empty"); >+const std::string IF_UNUSED("if_unused"); > } > > struct InvalidBindingIdentifier : public qpid::Exception >@@ -889,7 +893,14 @@ > } > QPID_LOG (debug, "Broker::delete(" << type << ", " << name << "," << options << ")"); > if (type == TYPE_QUEUE) { >- deleteQueue(name, userId, connectionId); >+ // extract ifEmpty and ifUnused from options >+ bool ifUnused = false, ifEmpty = false; >+ for (Variant::Map::const_iterator i = options.begin(); i != options.end(); ++i) { >+ if (i->first == IF_UNUSED) ifUnused = i->second.asBool(); >+ else if (i->first == IF_EMPTY) ifEmpty = i->second.asBool(); >+ } >+ deleteQueue(name, userId, connectionId, >+ boost::bind(&Broker::checkDeleteQueue, this, _1, ifUnused, ifEmpty)); > } else if (type == TYPE_EXCHANGE || type == TYPE_TOPIC) { > deleteExchange(name, userId, connectionId); > } else if (type == TYPE_BINDING) { >@@ -908,7 +919,17 @@ > } else { > throw UnknownObjectType(type); > } >+} > >+void Broker::checkDeleteQueue(Queue::shared_ptr queue, bool ifUnused, bool ifEmpty) >+{ >+ if(ifEmpty && queue->getMessageCount() > 0) { >+ throw qpid::framing::PreconditionFailedException(QPID_MSG("Cannot delete queue " >+ << queue->getName() << "; queue not empty")); >+ } else if(ifUnused && queue->getConsumerCount() > 0) { >+ throw qpid::framing::PreconditionFailedException(QPID_MSG("Cannot delete queue " >+ << queue->getName() << "; queue in use")); >+ } > } > > Manageable::status_t Broker::queryObject(const std::string& type, >Index: qpid/cpp/src/qpid/broker/Broker.h >=================================================================== >--- qpid/cpp/src/qpid/broker/Broker.h (revision 1447816) >+++ qpid/cpp/src/qpid/broker/Broker.h (working copy) >@@ -136,6 +136,7 @@ > const qpid::types::Variant::Map& properties, bool strict, const ConnectionState* context); > void deleteObject(const std::string& type, const std::string& name, > const qpid::types::Variant::Map& options, const ConnectionState* context); >+ void checkDeleteQueue(boost::shared_ptr<Queue> queue, bool ifUnused, bool ifEmpty); > Manageable::status_t queryObject(const std::string& type, const std::string& name, > qpid::types::Variant::Map& results, const ConnectionState* context); > Manageable::status_t queryQueue( const std::string& name,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 912519
: 702380