You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by James Sears <ja...@gmail.com> on 2017/11/16 17:30:17 UTC
python proton reactor "dynamic message selection"?
Is there a way - using the python proton reactor API - to do what I'd call dynamic message selection?
By this I mean I'd like my application to do something like this:
1. receive message M1 on queue Q1 with unique correlation_id N.
2. send message M2 to topic T1 with correlation_id N and reply_to queue Q2.
3. receive messages - M3, M4, etc - to Q2 and use a message selector with correlation_id N.
4. messages to Q2 would eventually reach their expiry_time.
5. remove message selector on Q2 with correlation_id N.
5. event back to step 1.
Is this sort of thing possible with proton reactor?
Just that I'm not sure how I'd be able to create and then remove selectors that are no longer required.
Thanks!
RE: python proton reactor "dynamic message selection"?
Posted by James Sears <ja...@gmail.com>.
Hi Gordon – just a quick thanks for pointing me to [2].
The use case is that of a loading XML into a sharded database: a message containing XML comes into the balancer (python proton reactor), the balancer asks, using a topic with a temp reply_to queue, which shard is smallest and then passes the XML to the smallest shard.
Playing around with [2], and server.py, showed me how to tie things together in a way I’m happy with.
Thanks!
From: Gordon Sim
Sent: 16 November 2017 19:56
To: users@qpid.apache.org
Subject: Re: python proton reactor "dynamic message selection"?
On 16/11/17 17:30, James Sears wrote:
> Is there a way - using the python proton reactor API - to do what I'd call dynamic message selection?
>
> By this I mean I'd like my application to do something like this:
>
> 1. receive message M1 on queue Q1 with unique correlation_id N.
> 2. send message M2 to topic T1 with correlation_id N and reply_to queue Q2.
> 3. receive messages - M3, M4, etc - to Q2 and use a message selector with correlation_id N.
> 4. messages to Q2 would eventually reach their expiry_time.
> 5. remove message selector on Q2 with correlation_id N.
> 5. event back to step 1.
>
> Is this sort of thing possible with proton reactor?
>
> Just that I'm not sure how I'd be able to create and then remove selectors that are no longer required.
Selectors are set when you create a receiver[1]. You can only remove
them by closing the receiver (and then optionally opening again with a
different selector (or no selector).
However, without fully understanding your use case, I'd suggest maybe
using a different reply queue for specific messages rather than trying
to use selectors for that. You can have reply queues created dynamically
on demand (e.g. [2])
[1]
https://git1-us-west.apache.org/repos/asf/qpid-proton/repo?p=qpid-proton.git;a=blob;f=examples/python/selected_recv.py;h=dc062d5f54dda321f9b4b7de7489a58f3a462a4b;hb=HEAD
[2]
https://git1-us-west.apache.org/repos/asf/qpid-proton/repo?p=qpid-proton.git;a=blob;f=examples/python/client.py;h=86f2c76a7bbe03e563ab0e44a5d1ecff296fdd4d;hb=HEAD#l35
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: python proton reactor "dynamic message selection"?
Posted by Gordon Sim <gs...@redhat.com>.
On 16/11/17 17:30, James Sears wrote:
> Is there a way - using the python proton reactor API - to do what I'd call dynamic message selection?
>
> By this I mean I'd like my application to do something like this:
>
> 1. receive message M1 on queue Q1 with unique correlation_id N.
> 2. send message M2 to topic T1 with correlation_id N and reply_to queue Q2.
> 3. receive messages - M3, M4, etc - to Q2 and use a message selector with correlation_id N.
> 4. messages to Q2 would eventually reach their expiry_time.
> 5. remove message selector on Q2 with correlation_id N.
> 5. event back to step 1.
>
> Is this sort of thing possible with proton reactor?
>
> Just that I'm not sure how I'd be able to create and then remove selectors that are no longer required.
Selectors are set when you create a receiver[1]. You can only remove
them by closing the receiver (and then optionally opening again with a
different selector (or no selector).
However, without fully understanding your use case, I'd suggest maybe
using a different reply queue for specific messages rather than trying
to use selectors for that. You can have reply queues created dynamically
on demand (e.g. [2])
[1]
https://git1-us-west.apache.org/repos/asf/qpid-proton/repo?p=qpid-proton.git;a=blob;f=examples/python/selected_recv.py;h=dc062d5f54dda321f9b4b7de7489a58f3a462a4b;hb=HEAD
[2]
https://git1-us-west.apache.org/repos/asf/qpid-proton/repo?p=qpid-proton.git;a=blob;f=examples/python/client.py;h=86f2c76a7bbe03e563ab0e44a5d1ecff296fdd4d;hb=HEAD#l35
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org