You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Siamak Kolahi <si...@gmail.com> on 2010/03/04 00:51:23 UTC

Question

Hi guys,

I am new to qpid and I have got a question for you guys. I am trying to
setup a Headers Exchange through the qpid which routs based on headers. As I
am seeing in AMQP spec, the headers should support some sort of wildcard
header, meaning the key should be present in the headers and can be carrying
any value (key -> void). I am doing it in Python and my question is that
which character is representing this wildcard header?

I have tried *, None, '' and "" and non of them seem to be working. could
anyone help me on figuring if this wildcard spec is implemented for header
exchanges in qpid or not.

Thanks,
Siamak

Re: Question

Posted by Gordon Sim <gs...@redhat.com>.
On 03/04/2010 04:33 PM, Siamak Kolahi wrote:
> Thanks for the Jira issue and I would appreciate if you let me know whenever
> its nailed down.

This is now fixed on trunk.

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


Re: Question

Posted by Gordon Sim <gs...@redhat.com>.
On 03/04/2010 05:38 PM, Siamak Kolahi wrote:
> Guys, is there any doc/reference about the api in Python? for now I am just
> looking into the code and test cases, and try to guess and find method! and
> the code is hard to follow.
> couldnt find any doc about the Python api?

There is some pydoc within the source. There is a version of that (0.5?) 
on the web site: http://qpid.apache.org/docs/api/python/html/index.html.

On trunk now you can generate html using setup.py (./setup.py 
build_doc). You can also get at it with an interactive python session 
using help().

Jonathan also has a nice 'quick reference': 
http://www.ibiblio.org/jwrobie/blog/?p=29

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


Re: Question

Posted by Siamak Kolahi <si...@gmail.com>.
Guys, is there any doc/reference about the api in Python? for now I am just
looking into the code and test cases, and try to guess and find method! and
the code is hard to follow.
couldnt find any doc about the Python api?

Thanks,
Siamak

On Thu, Mar 4, 2010 at 11:33 AM, Siamak Kolahi <si...@gmail.com>wrote:

> Thanks alot Sam and Gordon, and yes Gordon. thats exactly where the problem
> is. the empty() condition does not seem to be working for values comming
> over wire from Python. I am not sure what it is translated to over the wire,
> but from Python side, None makes the most sense to be used for that purpose,
> and it currently does not seem to be working.
>
> Thanks for the Jira issue and I would appreciate if you let me know
> whenever its nailed down.
>
> Thanks,
> Siamak
>
>
> On Thu, Mar 4, 2010 at 7:13 AM, Gordon Sim <gs...@redhat.com> wrote:
>
>> On 03/04/2010 11:46 AM, Sam Joyce wrote:
>>
>>> Hi Siamak,
>>>
>>> I've had a look in the Headers Exchange code and traced through the
>>> match() code. I've drilled down to the FieldValue impl, which is
>>> ultimately where it decides on a match (the operator==() method),
>>> someone else please jump in here but what I'm seeing is no support for
>>> wild-carding on header values.
>>>
>>
>> There is, but I think it is broken. HeadersExchange.cpp:255 defines
>> match_values and if the binding specified a key with an empty value, that
>> will match any value. I believe empty() is the wrong test and will never be
>> true for a map decoded off the wire.
>>
>> Setting the value to None in python when binding is the correct approach.
>>
>> I've raised a Jira for this (
>> https://issues.apache.org/jira/browse/QPID-2429) and we'll get it fixed
>> shortly. Thanks for pointing that out!
>>
>>
>>
>> ---------------------------------------------------------------------
>> Apache Qpid - AMQP Messaging Implementation
>> Project:      http://qpid.apache.org
>> Use/Interact: mailto:users-subscribe@qpid.apache.org
>>
>>
>

Re: Question

Posted by Siamak Kolahi <si...@gmail.com>.
Thanks alot Sam and Gordon, and yes Gordon. thats exactly where the problem
is. the empty() condition does not seem to be working for values comming
over wire from Python. I am not sure what it is translated to over the wire,
but from Python side, None makes the most sense to be used for that purpose,
and it currently does not seem to be working.

Thanks for the Jira issue and I would appreciate if you let me know whenever
its nailed down.

Thanks,
Siamak

On Thu, Mar 4, 2010 at 7:13 AM, Gordon Sim <gs...@redhat.com> wrote:

> On 03/04/2010 11:46 AM, Sam Joyce wrote:
>
>> Hi Siamak,
>>
>> I've had a look in the Headers Exchange code and traced through the
>> match() code. I've drilled down to the FieldValue impl, which is
>> ultimately where it decides on a match (the operator==() method),
>> someone else please jump in here but what I'm seeing is no support for
>> wild-carding on header values.
>>
>
> There is, but I think it is broken. HeadersExchange.cpp:255 defines
> match_values and if the binding specified a key with an empty value, that
> will match any value. I believe empty() is the wrong test and will never be
> true for a map decoded off the wire.
>
> Setting the value to None in python when binding is the correct approach.
>
> I've raised a Jira for this (
> https://issues.apache.org/jira/browse/QPID-2429) and we'll get it fixed
> shortly. Thanks for pointing that out!
>
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>

Re: Question

Posted by Gordon Sim <gs...@redhat.com>.
On 03/04/2010 11:46 AM, Sam Joyce wrote:
> Hi Siamak,
> I've had a look in the Headers Exchange code and traced through the
> match() code. I've drilled down to the FieldValue impl, which is
> ultimately where it decides on a match (the operator==() method),
> someone else please jump in here but what I'm seeing is no support for
> wild-carding on header values.

There is, but I think it is broken. HeadersExchange.cpp:255 defines 
match_values and if the binding specified a key with an empty value, 
that will match any value. I believe empty() is the wrong test and will 
never be true for a map decoded off the wire.

Setting the value to None in python when binding is the correct approach.

I've raised a Jira for this 
(https://issues.apache.org/jira/browse/QPID-2429) and we'll get it fixed 
shortly. Thanks for pointing that out!


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


Re: Question

Posted by Sam Joyce <sj...@redhat.com>.
Hi Siamak,
I've had a look in the Headers Exchange code and traced through the 
match() code. I've drilled down to the FieldValue impl, which is 
ultimately where it decides on a match (the operator==() method), 
someone else please jump in here but what I'm seeing is no support for 
wild-carding on header values. I know from the docs, that the XML 
Exchange supports # and * (multiple/single words) as wildcards but from 
my *very* brief look at the code I'm not seeing that support in the 
Headers Exchange. This could be a bug but I'll wait for more experienced 
qpid heads than mine to give their 2c.
As I am also fairly new to the code base, its very possible that the 
wildcarding support may be built into a class that I'm not familiar 
with. From what I've seen in the FieldValue class, its doing a direct 
compare to get a match.
all the best, and sorry I couldn't give you a better answer :)
Sam

Sam Joyce wrote:
> Hi Siamak,
> can you mail me a snippit of your code and I can try to figure out 
> what's going wrong.
> thanks,
> Sam.
>
> Siamak Kolahi wrote:
>> Hi guys,
>>
>> I am new to qpid and I have got a question for you guys. I am trying to
>> setup a Headers Exchange through the qpid which routs based on 
>> headers. As I
>> am seeing in AMQP spec, the headers should support some sort of wildcard
>> header, meaning the key should be present in the headers and can be 
>> carrying
>> any value (key -> void). I am doing it in Python and my question is that
>> which character is representing this wildcard header?
>>
>> I have tried *, None, '' and "" and non of them seem to be working. 
>> could
>> anyone help me on figuring if this wildcard spec is implemented for 
>> header
>> exchanges in qpid or not.
>>
>> Thanks,
>> Siamak
>>
>>   
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>


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


Re: Question

Posted by Sam Joyce <sj...@redhat.com>.
Hi Siamak,
can you mail me a snippit of your code and I can try to figure out 
what's going wrong.
thanks,
Sam.

Siamak Kolahi wrote:
> Hi guys,
>
> I am new to qpid and I have got a question for you guys. I am trying to
> setup a Headers Exchange through the qpid which routs based on headers. As I
> am seeing in AMQP spec, the headers should support some sort of wildcard
> header, meaning the key should be present in the headers and can be carrying
> any value (key -> void). I am doing it in Python and my question is that
> which character is representing this wildcard header?
>
> I have tried *, None, '' and "" and non of them seem to be working. could
> anyone help me on figuring if this wildcard spec is implemented for header
> exchanges in qpid or not.
>
> Thanks,
> Siamak
>
>   


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