Bug 1150127 - AMQP 1.0 consumer should be able to get messages from browse-only queue
Summary: AMQP 1.0 consumer should be able to get messages from browse-only queue
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-cpp
Version: 3.0
Hardware: All
OS: All
medium
medium
Target Milestone: 3.2
: ---
Assignee: Pavel Moravec
QA Contact: Petr Matousek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-07 13:30 UTC by Pavel Moravec
Modified: 2019-08-15 04:00 UTC (History)
3 users (show)

Fixed In Version: qpid-cpp-0.32-1
Doc Type: Bug Fix
Doc Text:
Qpid broker allowed 0-10 consumers on browse-only queues, but did not allow 1.0 consumers to attach to these queues. This caused read-only queues not to work as expected for customers. Improvements to `Queue.h` and `amqp/Session.cpp` now allow 1.0 consumers to attach to browse-only queues. The consumers are marked internally as browsers, which is consistent in behavior to 0-10 consumers.
Clone Of:
Environment:
Last Closed: 2015-10-08 13:09:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Apache JIRA QPID-6182 0 None None None Never
Red Hat Knowledge Base (Solution) 1238243 0 None None None Never
Red Hat Product Errata RHEA-2015:1879 0 normal SHIPPED_LIVE Red Hat Enterprise MRG Messaging 3.2 Release 2015-10-08 17:07:53 UTC

Description Pavel Moravec 2014-10-07 13:30:27 UTC
Description of problem:
Qpid broker allows 0-10 consumers on browse-only queues, but does not allow 1.0 consumers there. It should allow 1.0 consumers as well, marking them internally as browsers instead (like it does for 0-10 consumer).


Version-Release number of selected component (if applicable):
qpid-cpp 0.22-49


How reproducible:
100%


Steps to Reproduce:
1. service qpidd restart
2. qpid-config add queue q --argument=qpid.browse-only=true --limit-policy=ring --max-queue-count=100
3. qpid-send -a q -m1
4. qpid-receive -a q # works fine
5. qpid-receive -a q --connection-option "{protocol:amqp1.0}"


Actual results:
Step 5 returns:
qpid-receive: Link detached by peer with amqp:internal-error: not-allowed: Queue q is browse only.  Refusing acquiring consumer. (/home/pmoravec/qpid-trunk/qpid/cpp/src/qpid/broker/Queue.cpp:552)


Expected results:
Both 4. and 5. to return one message (one empty line corresponding to empty message content).


Additional info:

Comment 2 Pavel Moravec 2014-10-20 20:37:38 UTC
Potential patch:

Index: cpp/src/qpid/broker/Queue.h
===================================================================
--- cpp/src/qpid/broker/Queue.h	(revision 1633165)
+++ cpp/src/qpid/broker/Queue.h	(working copy)
@@ -387,6 +387,7 @@
     inline const QueueSettings& getSettings() const { return settings; }
     inline const qpid::framing::FieldTable& getEncodableSettings() const { return encodableSettings; }
     inline bool isAutoDelete() const { return settings.autodelete; }
+    inline bool isBrowseOnly() const { return settings.isBrowseOnly; }
     QPID_BROKER_EXTERN bool canAutoDelete() const;
     QPID_BROKER_EXTERN void scheduleAutoDelete();
     QPID_BROKER_EXTERN bool isDeleted() const;
Index: cpp/src/qpid/broker/amqp/Session.cpp
===================================================================
--- cpp/src/qpid/broker/amqp/Session.cpp	(revision 1633165)
+++ cpp/src/qpid/broker/amqp/Session.cpp	(working copy)
@@ -464,7 +464,7 @@
 
     if (node.queue) {
         authorise.outgoing(node.queue);
-        SubscriptionType type = pn_terminus_get_distribution_mode(source) == PN_DIST_MODE_COPY ? BROWSER : CONSUMER;
+        SubscriptionType type = (pn_terminus_get_distribution_mode(source) == PN_DIST_MODE_COPY) || (node.queue->isBrowseOnly()) ? BROWSER : CONSUMER;
         if (type == CONSUMER && node.queue->hasExclusiveOwner() && !node.queue->isExclusiveOwner(this)) {
             throw Exception(qpid::amqp::error_conditions::PRECONDITION_FAILED, std::string("Cannot consume from exclusive queue ") + node.queue->getName());
         }

Comment 3 Pavel Moravec 2014-10-23 12:21:51 UTC
Committed revision 1633798.

Comment 4 Pavel Moravec 2014-10-23 14:10:11 UTC
(In reply to Pavel Moravec from comment #3)
> Committed revision 1633798.

Committed revisions: 1633798 and 1633817. (originally I forgot to commit changes in one file)

Comment 6 Petr Matousek 2015-07-30 11:08:55 UTC
This issue has been fixed. Verified on rhel6.7 (x86_64, i386) and rhel7.1 (x86_64).

packages:
qpid-cpp-*-0.34-1

-> VERIFIED

Comment 8 errata-xmlrpc 2015-10-08 13:09:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHEA-2015-1879.html


Note You need to log in before you can comment on or make changes to this bug.