You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by rk <rk...@roke.co.uk> on 2018/10/17 15:57:14 UTC
Go Electron Header Subscription
Hi
I'm attempting to get a Go electron receiver working using a filter that
should give me behaviour akin to the legacy header exchange bindings. My
understanding is this can be done using this filter
apache.org:legacy-amqp-headers-binding:map. However the Go receiver I've
built seems to always receiver all messages not just the messages with the
appropriate headers.
My setup is:
I have a Go electron sender sending multiple messages some that should match
and some that don't. The headers are being place in the Application
Properties.
Using drain like
./drain -b qpid:5672 -f 'testqueue; {create: receiver, node: {x-declare:
{arguments:
{'qpid.policy_type': ring, 'qpid.max_size': 500000000}}, x-bindings:
[{exchange: 'amq.match', queue: 'testqueue', key: 'data1', arguments:
{x-match: all, colour: red}}]}}'
I only receive the events I'm expecting
my Go receiver https://play.golang.org/p/jUzqFoBqRy5
receives them all.
I've noticed the bindings on the broker look different when running
qpid-config list binding
drain
testqueue data1 0 u'colour': u'red', u'x-match': u'all'} amq.match
Go receiver
receiver_receiver@1 all 0 {u'x-match': 'all'} amq.match
Any help much appreciated
Rob
--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: Go Electron Header Subscription
Posted by Alan Conway <ac...@redhat.com>.
Many thanks for figuring this out, I'll add an example to the Go binding.
Both the Go and C++ examples are currently quite horrible - very raw access
to the somewhat nasty underlying AMQP definitions. I will look into
providing a more "cooked" API to simplify this task, along the lines of the
python Filter and Selector classes.
(note to astitcher,jross - this looks like code that should be rescued from
reactor.py and discussed for use across all bindings as part of the API
improvement work)
On Thu, Oct 18, 2018 at 8:19 AM Gordon Sim <gs...@redhat.com> wrote:
> On 18/10/18 10:09, rk wrote:
> > Thanks for the reply, I seem to of got it working by changing the Go code
> > tohttps://play.golang.org/p/3805Mlqu5f4. Though I'm not sure what the
> > string in the filter map (currently "selector") represents, I seem to be
> > able to put anything in there.
>
> Yes, the value of the key is unimportant. Glad you got it working;
> thanks for letting us know. (And now I know a bit more of the go api!)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>
Re: Go Electron Header Subscription
Posted by Gordon Sim <gs...@redhat.com>.
On 18/10/18 10:09, rk wrote:
> Thanks for the reply, I seem to of got it working by changing the Go code
> tohttps://play.golang.org/p/3805Mlqu5f4. Though I'm not sure what the
> string in the filter map (currently "selector") represents, I seem to be
> able to put anything in there.
Yes, the value of the key is unimportant. Glad you got it working;
thanks for letting us know. (And now I know a bit more of the go api!)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: Go Electron Header Subscription
Posted by rk <rk...@roke.co.uk>.
Gordon Sim wrote
> On 17/10/18 16:57, rk wrote:
>> I'm attempting to get a Go electron receiver working using a filter that
>> should give me behaviour akin to the legacy header exchange bindings. My
>> understanding is this can be done using this filter
>> apache.org:legacy-amqp-headers-binding:map. However the Go receiver I've
>> built seems to always receiver all messages not just the messages with
>> the
>> appropriate headers.
>
> I don't know the electron API I'm afraid, but the filter is a map whose
> keys don't actually matter, but whose values must be described types.
> I.e. the apache.org:legacy-amqp-headers-binding:map' is not a key but a
> descriptor of the value (which is itself a map). (Yes it is
> un-necessarily complicated!). The map representing the headers binding
> is keyed by string rather than by symbol.
>
>
>
> Thanks for the reply, I seem to of got it working by changing the Go code
> to https://play.golang.org/p/3805Mlqu5f4. Though I'm not sure what the
> string in the filter map (currently "selector") represents, I seem to be
> able to put anything in there.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@.apache
> For additional commands, e-mail:
> users-help@.apache
--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: Go Electron Header Subscription
Posted by Gordon Sim <gs...@redhat.com>.
On 17/10/18 16:57, rk wrote:
> I'm attempting to get a Go electron receiver working using a filter that
> should give me behaviour akin to the legacy header exchange bindings. My
> understanding is this can be done using this filter
> apache.org:legacy-amqp-headers-binding:map. However the Go receiver I've
> built seems to always receiver all messages not just the messages with the
> appropriate headers.
I don't know the electron API I'm afraid, but the filter is a map whose
keys don't actually matter, but whose values must be described types.
I.e. the apache.org:legacy-amqp-headers-binding:map' is not a key but a
descriptor of the value (which is itself a map). (Yes it is
un-necessarily complicated!). The map representing the headers binding
is keyed by string rather than by symbol.
Alan, do you have a code example/snippet showing how to encode described
types in proton go?
However you can get the same behaviour using a selector filter which may
be simpler (and which other brokers implement as well, meaning more
portability). It does still need to be expressed as a described value
though. There are examples for python and c++ in proton (see
selected_recv.py/selected_recv.cpp).
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org