You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Fraser Adams <fr...@blueyonder.co.uk> on 2011/12/09 14:57:49 UTC

Bindings in address string not recreated after dynamically unbinding.

Hi
I've noticed some slightly weird behaviour with respect to bindings.

I've got a Java test consumer client with an address string in JNDI as 
follows

destination.subscribedAddress1 = test; {create: always, node: 
{x-bindings: [{exchange: 'amq.direct', queue: 'test', key: 'test'}]}}

So nothing special so far.

I've got some QMF2 code I'm working on that dynamically unbinds when the 
queue threshold is exceeded.

That works OK and removes the binding fine.

But what's weird (to me at any rate) is that if I re-run my consumer 
with the address above I'd have expected the binding to get recreated, 
but it doesn't!!

I can re-add the binding using qpid-config and also via the QMF create 
method, just not from the address string.

If I remove the queue and try again everything gets re-created as expected.

This seems like a subtle little bug to me, or have I discovered some 
quirky "expected behaviour" :-)

I'm using Qpid 0.12 C++ broker with JMS clients.
Frase


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bindings in address string not recreated after dynamically unbinding.

Posted by Gordon Sim <gs...@redhat.com>.
On 12/09/2011 02:32 PM, Fraser Adams wrote:
> Is there a good explanation anywhere about the distinction between nodes
> and links.

The terms are borrowed from the AMQP 1.0 specification.

My own interpretation is that a node is an addressable entity. A link is 
a relationship between a particular producer or a consumer of messages 
and a node.

A subscription is a link from a node to a client - a link over which 
messages are intended to flow. There is no similar term in common usage 
for the analogous relationship on the producer side (and indeed prior to 
1.0 AMQP had no concept of such a link).

In terms of addressing therefore, the node is the thing the address as a 
whole actually refers to. The link options control properties of the 
links established to or (more commonly) from the node. The x-bindings in 
the link section are created and deleted along with the link. Those in 
the node section are assumed to have a lifecycle contemporaneous to the 
node (though the actual implementation is quite loose in what it allows).

Does that make any sense?

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bindings in address string not recreated after dynamically unbinding.

Posted by Fraser Adams <fr...@blueyonder.co.uk>.
Ahhh thanks Alan,
To be honest I've never really figured out what the difference is 
between node and link blocks in address strings.

Is there a good explanation anywhere about the distinction between nodes 
and links. Most of the info on address strings is in the Programming in 
Apache Qpid book, but this is rather sketchy about the whys and 
wherefores of nodes and links.

Frase

Alan Conway wrote:
> On 12/09/2011 08:57 AM, Fraser Adams wrote:
>> Hi
>> I've noticed some slightly weird behaviour with respect to bindings.
>>
>> I've got a Java test consumer client with an address string in JNDI 
>> as follows
>>
>> destination.subscribedAddress1 = test; {create: always, node: 
>> {x-bindings:
>> [{exchange: 'amq.direct', queue: 'test', key: 'test'}]}}
>>
>> So nothing special so far.
>>
>> I've got some QMF2 code I'm working on that dynamically unbinds when 
>> the queue
>> threshold is exceeded.
>>
>> That works OK and removes the binding fine.
>>
>> But what's weird (to me at any rate) is that if I re-run my consumer 
>> with the
>> address above I'd have expected the binding to get recreated, but it 
>> doesn't!!
>>
>> I can re-add the binding using qpid-config and also via the QMF 
>> create method,
>> just not from the address string.
>>
>> If I remove the queue and try again everything gets re-created as 
>> expected.
>>
>> This seems like a subtle little bug to me, or have I discovered some 
>> quirky
>> "expected behaviour" :-)
>
> You have specified the binding as a node: property in your address. 
> That means the bindings are done if/when the node (in this case queue) 
> is created. Hence if the queue is already there nothing  happens. You 
> can also specify the binding as a link: property. That will get 
> re-created every time you connect to the address.
>


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bindings in address string not recreated after dynamically unbinding.

Posted by Fraser Adams <fr...@blueyonder.co.uk>.
>
> This is an area that has been underspecified. The c++ client will 
> create the binding if it does not exist even if the node already exists.
>
> The python client only considers the binding if the node doesn't 
> exist. It sounds like the JMS client does the same.
>
> Personally I think the former behaviour is more intuitive, more 
> consistent and more useful.
I agree with you Gordon.
I also agree that it could do with some more explanation, I suspect I'm 
not the only person in the dark on nodes/links

>
>> You can
>> also specify the binding as a link: property. That will get re-created
>> every time you connect to the address.
>
> It is also removed whenever your sender/receiver is closed however, 
> which may or may not be what is desired.
>
That's not really what I'd like for most of my scenarios, I might have a 
client die but I'd like the queue to be buffering messages for that 
client in that case - removing the binding when the client dies wouldn't 
help me there.

One other slight bit of inconsistent behaviour I noticed was (and this 
was with bindings to a headers exchange) that if I *changed* the binding 
e.g. by changing an x-match property "value" what actually happened was 
that an *additional* binding got added, which is somewhat 
counterintuitive (this was with a node binding). This behaviour is 
counter to Alan's comment "You have specified the binding as a node: 
property in your address. That  means the bindings are done if/when the 
node (in this case queue) is created. Hence if the queue is already 
there nothing happens.". I've not tried this for some time though 
(probably back when I was running Qpid 0.8). If I get a moment I'll see 
if it still does this.

Frase







---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bindings in address string not recreated after dynamically unbinding.

Posted by Gordon Sim <gs...@redhat.com>.
On 12/09/2011 02:15 PM, Alan Conway wrote:
> On 12/09/2011 08:57 AM, Fraser Adams wrote:
>> Hi
>> I've noticed some slightly weird behaviour with respect to bindings.
>>
>> I've got a Java test consumer client with an address string in JNDI as
>> follows
>>
>> destination.subscribedAddress1 = test; {create: always, node:
>> {x-bindings:
>> [{exchange: 'amq.direct', queue: 'test', key: 'test'}]}}
>>
>> So nothing special so far.
>>
>> I've got some QMF2 code I'm working on that dynamically unbinds when
>> the queue
>> threshold is exceeded.
>>
>> That works OK and removes the binding fine.
>>
>> But what's weird (to me at any rate) is that if I re-run my consumer
>> with the
>> address above I'd have expected the binding to get recreated, but it
>> doesn't!!
>>
>> I can re-add the binding using qpid-config and also via the QMF create
>> method,
>> just not from the address string.
>>
>> If I remove the queue and try again everything gets re-created as
>> expected.
>>
>> This seems like a subtle little bug to me, or have I discovered some
>> quirky
>> "expected behaviour" :-)
>
> You have specified the binding as a node: property in your address. That
> means the bindings are done if/when the node (in this case queue) is
> created. Hence if the queue is already there nothing happens.

This is an area that has been underspecified. The c++ client will create 
the binding if it does not exist even if the node already exists.

The python client only considers the binding if the node doesn't exist. 
It sounds like the JMS client does the same.

Personally I think the former behaviour is more intuitive, more 
consistent and more useful.

> You can
> also specify the binding as a link: property. That will get re-created
> every time you connect to the address.

It is also removed whenever your sender/receiver is closed however, 
which may or may not be what is desired.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bindings in address string not recreated after dynamically unbinding.

Posted by Alan Conway <ac...@redhat.com>.
On 12/09/2011 08:57 AM, Fraser Adams wrote:
> Hi
> I've noticed some slightly weird behaviour with respect to bindings.
>
> I've got a Java test consumer client with an address string in JNDI as follows
>
> destination.subscribedAddress1 = test; {create: always, node: {x-bindings:
> [{exchange: 'amq.direct', queue: 'test', key: 'test'}]}}
>
> So nothing special so far.
>
> I've got some QMF2 code I'm working on that dynamically unbinds when the queue
> threshold is exceeded.
>
> That works OK and removes the binding fine.
>
> But what's weird (to me at any rate) is that if I re-run my consumer with the
> address above I'd have expected the binding to get recreated, but it doesn't!!
>
> I can re-add the binding using qpid-config and also via the QMF create method,
> just not from the address string.
>
> If I remove the queue and try again everything gets re-created as expected.
>
> This seems like a subtle little bug to me, or have I discovered some quirky
> "expected behaviour" :-)

You have specified the binding as a node: property in your address. That means 
the bindings are done if/when the node (in this case queue) is created. Hence if 
the queue is already there nothing  happens. You can also specify the binding as 
a link: property. That will get re-created every time you connect to the address.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org