[rabbitmq-discuss] Queue bound by a percentage change?
rtrlists at googlemail.com
Wed Feb 2 12:10:32 GMT 2011
On Wed, Feb 2, 2011 at 3:28 AM, James Carr <james.r.carr at gmail.com> wrote:
> I've been wondering what kind of scheme would be useful for binding
> queues to be notified for certain changes in a value. For example, say
> I have a stock system that applications can bind to and be notified
> if, for excample, IBM's stock price has risen 2.00 or more, if the
> price has dropped more than 2%, etc. What kind of scheme would work
> best in this case?
If you really need to do this kind of thing through a queue binding, rather
than consumer value checks, the only thing that comes to mind is to have the
producer band the values, so you can subscribe to bands. For example, have
the producer use 1% bands in the routing key, 0 for 0<= x < 1, 1 for 1<= x
<2, etc. and then bind your queue to as many ranges as you are interested.
Or you could use a filtering shovel, which does the range checking for you.
And just in case, you aren't talking about keeping track of the %-age
change? Cause that would involve keeping state in a sliding window and make
things a wee bit more complicated.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rabbitmq-discuss