[rabbitmq-discuss] Query for Binding with similar topic routing keys returns all similar vs the one matching

Helena Edelson hedelson at vmware.com
Wed Oct 12 15:48:16 BST 2011


Matthias,

Given the following precondition:
Bindings exist that routing keys such as #.foo.bar and *.foo.bar would match.
Where objOption is the Option returned from GET /api/bindings/vhost/e/exchange/q/queue/routingKey  which unfortunately is either a binding or an array of bindings matching the #etc pattern

Case 1: If I pass in binding pattern #.foo.bar, I get an array of Bindings
Case 2: If I pass in binding pattern *.foo.bar, I consistently get a single matching Binding

Here is what I am doing, in scala, where I want to extract one binding given one pattern (routing key).

if (objOption.isDefined) objOption.get match {
   
   case bindings: Array[Binding] => for { b <- bindings if b.getRoutingKey == pattern } binding = b

   case b: Binding => binding = objOption.get.asInstanceOf[Binding] 
}
 

Helena
________________________________________
From: Matthias Radestock [matthias at rabbitmq.com]
Sent: Wednesday, October 12, 2011 7:21 AM
To: Helena Edelson
Cc: rabbitmq-discuss at lists.rabbitmq.com
Subject: Re: [rabbitmq-discuss] Query for Binding with similar topic routing keys returns all similar vs the one matching

Helena,

On 11/10/11 14:15, Helena Edelson wrote:
> I found the user of the # character in the pattern of the binding,
> given the number and type of binding patterns between queues and
> exchanges, consistently returns multiple results vs the * character
> which Rabbit can return a singular match. So I had to write a work
> around :-)

So do you think there is something broken there in rabbit? Or perhaps
less obvious than it could be? If so, an example of the form "I tried X
and was expecting to see Y but instead got Z" would help to shed light
on the problem.

Matthias.


More information about the rabbitmq-discuss mailing list