You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Rajesh Khan <ra...@gmail.com> on 2012/12/31 11:43:55 UTC
Last Value Queue - Information Required
After reading about the LV queue. I wanted to implement the following
scenario. I have 3 symbols A,B and C and I want the queue to always hold
the latest prices of these symbols.
My question is will I have to create a separate queue for each symbol ? Any
suggestions would be appreciated.
Re: Last Value Queue - Information Required
Posted by Rajesh Khan <ra...@gmail.com>.
Thanks pavel that helped.
On Mon, Dec 31, 2012 at 4:07 AM, Pavel Moravec <pm...@redhat.com> wrote:
> Hi Khan,
> no, one queue is enough. See my favourite example below:
>
> # create a LVQ named MyLVQ with values stored in header field
> "stock-symbol"
> qpid-config add queue MyLVQ --argument
> qpid.last_value_queue_key=stock-symbol
>
> # generate some messages with stock prices
> $ qpid-send -a "MyLVQ" --property 'stock-symbol'='RHT' --property
> 'stock-value'='50' -m 1
> $ qpid-send -a "MyLVQ" --property 'stock-symbol'='ORCL' --property
> 'stock-value'='50' -m 1
> $ qpid-send -a "MyLVQ" --property 'stock-symbol'='RHT' --property
> 'stock-value'='53' -m 1
> $ qpid-send -a "MyLVQ" --property 'stock-symbol'='MSFT' --property
> 'stock-value'='50' -m 1
> $ qpid-send -a "MyLVQ" --property 'stock-symbol'='RHT' --property
> 'stock-value'='52' -m 1
>
> # read the queue content - only the latest stock-symbol value will be
> printed
> $ qpid-receive -a "MyLVQ" --print-headers yes --print-content no -m 10
> Properties: {sn:1, stock-symbol:ORCL, stock-value:50,
> ts:1356948468924902877, x-amqp-0-10.routing-key:MyLVQ}
>
> Properties: {sn:1, stock-symbol:MSFT, stock-value:50,
> ts:1356948468994528314, x-amqp-0-10.routing-key:MyLVQ}
>
> Properties: {sn:1, stock-symbol:RHT, stock-value:52,
> ts:1356948469024261662, x-amqp-0-10.routing-key:MyLVQ}
>
> $
>
> Kind regards,
> Pavel
>
>
> ----- Original Message -----
> > From: "Rajesh Khan" <ra...@gmail.com>
> > To: users@qpid.apache.org
> > Sent: Monday, December 31, 2012 11:43:55 AM
> > Subject: Last Value Queue - Information Required
> >
> > After reading about the LV queue. I wanted to implement the following
> > scenario. I have 3 symbols A,B and C and I want the queue to always
> > hold
> > the latest prices of these symbols.
> > My question is will I have to create a separate queue for each symbol
> > ? Any
> > suggestions would be appreciated.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>
Re: Last Value Queue - Information Required
Posted by Pavel Moravec <pm...@redhat.com>.
Hi Khan,
no, one queue is enough. See my favourite example below:
# create a LVQ named MyLVQ with values stored in header field "stock-symbol"
qpid-config add queue MyLVQ --argument qpid.last_value_queue_key=stock-symbol
# generate some messages with stock prices
$ qpid-send -a "MyLVQ" --property 'stock-symbol'='RHT' --property 'stock-value'='50' -m 1
$ qpid-send -a "MyLVQ" --property 'stock-symbol'='ORCL' --property 'stock-value'='50' -m 1
$ qpid-send -a "MyLVQ" --property 'stock-symbol'='RHT' --property 'stock-value'='53' -m 1
$ qpid-send -a "MyLVQ" --property 'stock-symbol'='MSFT' --property 'stock-value'='50' -m 1
$ qpid-send -a "MyLVQ" --property 'stock-symbol'='RHT' --property 'stock-value'='52' -m 1
# read the queue content - only the latest stock-symbol value will be printed
$ qpid-receive -a "MyLVQ" --print-headers yes --print-content no -m 10
Properties: {sn:1, stock-symbol:ORCL, stock-value:50, ts:1356948468924902877, x-amqp-0-10.routing-key:MyLVQ}
Properties: {sn:1, stock-symbol:MSFT, stock-value:50, ts:1356948468994528314, x-amqp-0-10.routing-key:MyLVQ}
Properties: {sn:1, stock-symbol:RHT, stock-value:52, ts:1356948469024261662, x-amqp-0-10.routing-key:MyLVQ}
$
Kind regards,
Pavel
----- Original Message -----
> From: "Rajesh Khan" <ra...@gmail.com>
> To: users@qpid.apache.org
> Sent: Monday, December 31, 2012 11:43:55 AM
> Subject: Last Value Queue - Information Required
>
> After reading about the LV queue. I wanted to implement the following
> scenario. I have 3 symbols A,B and C and I want the queue to always
> hold
> the latest prices of these symbols.
> My question is will I have to create a separate queue for each symbol
> ? Any
> suggestions would be appreciated.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org