Bug 1025760

Summary: Obsolete example of exclusive binding
Product: Red Hat Enterprise MRG Reporter: Petr Matousek <pematous>
Component: Messaging_Programming_ReferenceAssignee: Jared MORGAN <jmorgan>
Status: CLOSED CURRENTRELEASE QA Contact: Eric Sammons <esammons>
Severity: medium Docs Contact:
Priority: unspecified    
Version: DevelopmentCC: esammons, gsim, jross, mmurray, pematous, zkraus
Target Milestone: 3.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-22 15:28:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Petr Matousek 2013-11-01 13:33:55 UTC
Description of problem:

There is an low level api example in the following section:
4.6.6. Exclusive Bindings for Direct Exchanges

The LLAPI is deprecated for mrg-m-300, so the high level api equivalent shall be provided.

Version-Release number of selected component (if applicable):
Messaging Programming Reference - Revision 0.0.0-9

How reproducible:
n/a

Steps to Reproduce:
n/a

Actual results:
Low level api example in the documentation even if the LLAPI was deprecated

Expected results:
No LLAPI examples in the documentation

Comment 1 Joshua Wulf 2014-04-01 05:54:04 UTC
Are you sure about this? That same method is used here:

https://qpid.apache.org/releases/qpid-0.24/cpp-broker/book/ch01s03.html

If it needs to be replaced with another API method, is there a link to an example somewhere?

Comment 2 Petr Matousek 2014-04-01 11:29:24 UTC
(In reply to Joshua Wulf from comment #1)
> Are you sure about this? That same method is used here:
> 
> https://qpid.apache.org/releases/qpid-0.24/cpp-broker/book/ch01s03.html
> 
> If it needs to be replaced with another API method, is there a link to an
> example somewhere?

Yes, I'm pretty sure about that. The examples from the link above uses qpid::client api which was deprecated in Vienna (see bug 1008565 for details).

I would expect that exclusive-binding on exchange may be defined the following way:

1. create direct exchange and define the exclusive binding:
./drain "my-direct;{create:always, node: {type:topic, x-declare:{type: direct, arguments: {qpid.exclusive-binding:True}}}}"

2. create a subscription, bind to the exchange using 'routing-key'
./drain -f "q1;{create:always, node: {x-bindings:[{'exchange': my-direct, key: routing-key }]}}"

3. create another subscription, bind to the exchange using exactly the same 'routing-key'
$cppapi/drain -f "q2;{create:always, node: {x-bindings:[{'exchange': my-direct, key: routing-key }]}}"

I was expecting that the second bind shall be rejected, but it's NOT, both binding were created:

# qpid-config -r exchanges
Exchange 'my-direct' (direct)
    bind [routing-key] => q1
    bind [routing-key] => q2

Thus I'm wondering if that functionality is still supported at all?

Also, I'm wondering how a similar case may be done using amqp1.0, because of the missing support for node scoped x-bindings.

Please recheck with developers.

Comment 3 Joshua Wulf 2014-04-02 05:03:28 UTC
Gordon, are you able to provide some insight on this?

Comment 4 Gordon Sim 2014-04-02 11:21:39 UTC
The qpid.exclusive-binding arguments shold be provided on the binding (not when creating the exchange). So with the messaging API an example might be e.g.

drain -f "amq.direct; {create:always, link: {name:one, x-bindings:[{key:unique, arguments: {qpid.exclusive-binding:True}}]}}"

at which point qpid-config exchange -r shows:

$ qpid-config exchanges -r
Exchange '' (direct)
    bind [39770289-1a20-4bcd-9011-670a9a9e93c3:0.0] => 39770289-1a20-4bcd-9011-670a9a9e93c3:0.0
    bind [one] => one
Exchange 'amq.direct' (direct)
    bind [unique] => one {u'qpid.exclusive-binding': True}
Exchange 'amq.fanout' (fanout)
Exchange 'amq.match' (headers)
Exchange 'amq.topic' (topic)
Exchange 'my-direct' (direct)
Exchange 'qmf.default.direct' (direct)
Exchange 'qmf.default.topic' (topic)
    bind [direct.3cdb2983-6dd3-4ba4-98fe-c55dce6c0b8d] => 39770289-1a20-4bcd-9011-670a9a9e93c3:0.0
Exchange 'qpid.management' (topic)

and then in another terminal:

drain -f "amq.direct; {create:always, link: {name:two, x-bindings:[{key:unique, arguments: {qpid.exclusive-binding:True}}]}}"

after which qpid-config exchange -r now shows:

$ qpid-config exchanges -r
Exchange '' (direct)
    bind [9e5641a4-e758-4f56-a7c6-861628494068:0.0] => 9e5641a4-e758-4f56-a7c6-861628494068:0.0
    bind [one] => one
    bind [two] => two
Exchange 'amq.direct' (direct)
    bind [unique] => two {u'qpid.exclusive-binding': True}
Exchange 'amq.fanout' (fanout)
Exchange 'amq.match' (headers)
Exchange 'amq.topic' (topic)
Exchange 'my-direct' (direct)
Exchange 'qmf.default.direct' (direct)
Exchange 'qmf.default.topic' (topic)
    bind [direct.789b5f64-125c-4f1f-ad38-e1952150fb73] => 9e5641a4-e758-4f56-a7c6-861628494068:0.0
Exchange 'qpid.management' (topic)

I.e. a single binding to amq.direct for that key is enforced (and now maps to the second queue, named 'two'). If you now send a message to amq.direct/unique, only the second binding will get it.

This feature is not at present accessible over AMQP 1.0.