You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Davide Anastasia <Da...@qualitycapital.com> on 2012/02/29 11:39:09 UTC

Update message content

Hi All,

Suppose I have a queue where I receive prices for financial instruments,
where every instrument is a topic (instrument1, instrument2,
instrument3... so on) and I want to subscribe to this queue (maybe to a
subset of topics). However, I am not interested in receiving all the
messages, but only the last update: is there a way to constantly change
the content of a certain message (a certain topic in this case) so that
a subscriber at a certain moment of time sees only the last update?

 

Best regards,

 

Davide Anastasia
Analyst, Research & Development


Quality Capital Management Ltd.
QCM House * Horizon Business Village
No. 1 Brooklands Road
Weybridge * Surrey KT13 0TJ
United Kingdom

Tel: +44 (0) 1932 334 400
Fax: +44 (0) 1932 334 415
Email: Davide.Anastasia@QualityCapital.com
<ma...@QualityCapital.com> 

www.qualitycapital.com <http://www.qualitycapital.com/> 

________________________________

This email and any attachments are confidential and intended solely for
the use of the individual(s) to whom it is addressed. 

Any views or opinions presented are solely those of the author and do
not necessarily represent those of Quality Capital Management Ltd. If
you are not the intended recipient, be advised that you have received
this email in error and that any use, dissemination, printing,
forwarding or copying of this email is strictly prohibited. Please
contact the sender if you have received this email in error. You should
also be aware that emails are susceptible to interference and you should
not assume that the contents of this email originated from the sender
above or that they have been accurately reproduced in their original
form. Quality Capital Management Ltd is authorised and regulated by the
Financial Services Authority in the UK and is a member of the National
Futures Association in the US. 

________________________________

 


RE: Update message content

Posted by Davide Anastasia <Da...@qualitycapital.com>.
Hi Jakub,
That's pure magic, it really works! So much grateful for that.

Best,
Davide

-----Original Message-----
From: Jakub Scholz [mailto:jakub@scholz.cz] 
Sent: 05 March 2012 15:12
To: users@qpid.apache.org
Subject: Re: Update message content

Hi Davide,

I think for your scenario, the sender should use following address:

amq.topic/<instrumet>; { node: { type: topic} }

and the receiver may use following address:

ticker; {create:always, node:{type:queue, x-declare:{arguments:{'qpid.last_value_queue_key':'qpid.subject'} }, x-bindings:[{ exchange: 'topic_exchange', queue: 'ticker', key:
'<Instrumet1>' }, { exchange: 'topic_exchange', queue: 'ticker', key:
'<Instrumet2>' } ] } }

The sender will send the messages to the amq.topic exchange with the instrument name as an routing key / subject. The receiver will create a queue named "ticker" as an last value queue and will subscribe the messages which will match the instruments specified in the x-bindings key - the messages for other instruments will not be delivered to your queue.

Hope this helps.

Regards
Jakub

On Mon, Mar 5, 2012 at 11:00, Davide Anastasia <Da...@qualitycapital.com> wrote:
> Hi Gordon,
> Thanks for your reply.
>
> I did not explicitly created the queue using qpid-config, but I am 
> using this configuration string on the sender side (is it the same?):
>
> ticker;{create:always,
> node:{type:queue,x-declare:{arguments:{'qpid.last_value_queue_key':'qp
> id
> .subject'}}}}
>
> then I am putting into every subject the name of the instrument, doing
> that:
>
> qpid_message.setSubject( instr_name );  // set subject
>
> where instr_name is an std::string holding the name of the instrument.
>
> On the receiver side however I would like to receive updates only on a 
> certain subject (namely, a certain instrument).
> I have tried different solution, but none works: I always get the ALL 
> set of instruments.
>
> Currently I am using this address string on the receiver side:
>
> ticker/instrument_name;{create:sender, mode:browse, node:{type:queue}}
>
> What am I doing wrong?
>
> Thanks a lot,
> Davide

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org For additional commands, e-mail: users-help@qpid.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Update message content

Posted by Jakub Scholz <ja...@scholz.cz>.
Hi Davide,

I think for your scenario, the sender should use following address:

amq.topic/<instrumet>; { node: { type: topic} }

and the receiver may use following address:

ticker; {create:always, node:{type:queue,
x-declare:{arguments:{'qpid.last_value_queue_key':'qpid.subject'} },
x-bindings:[{ exchange: 'topic_exchange', queue: 'ticker', key:
'<Instrumet1>' }, { exchange: 'topic_exchange', queue: 'ticker', key:
'<Instrumet2>' } ] } }

The sender will send the messages to the amq.topic exchange with the
instrument name as an routing key / subject. The receiver will create
a queue named "ticker" as an last value queue and will subscribe the
messages which will match the instruments specified in the x-bindings
key - the messages for other instruments will not be delivered to your
queue.

Hope this helps.

Regards
Jakub

On Mon, Mar 5, 2012 at 11:00, Davide Anastasia
<Da...@qualitycapital.com> wrote:
> Hi Gordon,
> Thanks for your reply.
>
> I did not explicitly created the queue using qpid-config, but I am using
> this configuration string on the sender side (is it the same?):
>
> ticker;{create:always,
> node:{type:queue,x-declare:{arguments:{'qpid.last_value_queue_key':'qpid
> .subject'}}}}
>
> then I am putting into every subject the name of the instrument, doing
> that:
>
> qpid_message.setSubject( instr_name );  // set subject
>
> where instr_name is an std::string holding the name of the instrument.
>
> On the receiver side however I would like to receive updates only on a
> certain subject (namely, a certain instrument).
> I have tried different solution, but none works: I always get the ALL
> set of instruments.
>
> Currently I am using this address string on the receiver side:
>
> ticker/instrument_name;{create:sender, mode:browse, node:{type:queue}}
>
> What am I doing wrong?
>
> Thanks a lot,
> Davide

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


RE: Update message content

Posted by Davide Anastasia <Da...@qualitycapital.com>.
Hi Gordon,
Thanks for your reply.

I did not explicitly created the queue using qpid-config, but I am using
this configuration string on the sender side (is it the same?):

ticker;{create:always,
node:{type:queue,x-declare:{arguments:{'qpid.last_value_queue_key':'qpid
.subject'}}}}

then I am putting into every subject the name of the instrument, doing
that:

qpid_message.setSubject( instr_name );  // set subject

where instr_name is an std::string holding the name of the instrument.

On the receiver side however I would like to receive updates only on a
certain subject (namely, a certain instrument).
I have tried different solution, but none works: I always get the ALL
set of instruments.

Currently I am using this address string on the receiver side:

ticker/instrument_name;{create:sender, mode:browse, node:{type:queue}}

What am I doing wrong?

Thanks a lot,
Davide

-----Original Message-----
From: Gordon Sim [mailto:gsim@redhat.com] 
Sent: 02 March 2012 18:09
To: users@qpid.apache.org
Subject: Re: Update message content

On 03/02/2012 05:57 PM, Gordon Sim wrote:
> On 03/02/2012 03:14 PM, Davide Anastasia wrote:
>> Hi Jakub,
>> Thanks a lot for your help: it really helped me a lot. However, I 
>> couldn't find a way to filter messages using their subject. For 
>> instance, I created my queue with the name "ticker" and then I sent 
>> messages using routing_key like "instr1", "instr2", and so on.
>> Unfortunately, on the receiver side I still receive all the messages.
>
> http://qpid.apache.org/books/trunk/AMQP-Messaging-Broker-CPP-Book/html
> /ch01s06.html is the correct link to use for anything since the Qpid 
> 0.10 release. The older content is now out of date and describes 
> deprecated behaviour.

And more specifically, did you configure your queue as an LVQ? You can't
(at present) key on the routing key itself, but if you are using the
qpid::messaging API (whether in c++ or python) then you can use
'qpid.subject' as a substitute.

E.g.

qpid-config add queue ticker --argument
qpid.last_value_queue_key=qpid.subject

then e.g.

spout --content a1 ticker/instr1
spout --content a2 ticker/instr2
spout --content b1 ticker/instr1

etc, and the queue will hold the last values of each instrument. You can
set up browsers on the queue that will get the latest set and then any
further updates. E.g.

drain 'ticker; {mode: browse}'

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


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Update message content

Posted by Gordon Sim <gs...@redhat.com>.
On 03/02/2012 05:57 PM, Gordon Sim wrote:
> On 03/02/2012 03:14 PM, Davide Anastasia wrote:
>> Hi Jakub,
>> Thanks a lot for your help: it really helped me a lot. However, I
>> couldn't find a way to filter messages using their subject. For
>> instance, I created my queue with the name "ticker" and then I sent
>> messages using routing_key like "instr1", "instr2", and so on.
>> Unfortunately, on the receiver side I still receive all the messages.
>
> http://qpid.apache.org/books/trunk/AMQP-Messaging-Broker-CPP-Book/html/ch01s06.html
> is the correct link to use for anything since the Qpid 0.10 release. The
> older content is now out of date and describes deprecated behaviour.

And more specifically, did you configure your queue as an LVQ? You can't 
(at present) key on the routing key itself, but if you are using the 
qpid::messaging API (whether in c++ or python) then you can use 
'qpid.subject' as a substitute.

E.g.

qpid-config add queue ticker --argument 
qpid.last_value_queue_key=qpid.subject

then e.g.

spout --content a1 ticker/instr1
spout --content a2 ticker/instr2
spout --content b1 ticker/instr1

etc, and the queue will hold the last values of each instrument. You can 
set up browsers on the queue that will get the latest set and then any 
further updates. E.g.

drain 'ticker; {mode: browse}'

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


Re: Update message content

Posted by Gordon Sim <gs...@redhat.com>.
On 03/02/2012 03:14 PM, Davide Anastasia wrote:
> Hi Jakub,
> Thanks a lot for your help: it really helped me a lot. However, I
> couldn't find a way to filter messages using their subject. For
> instance, I created my queue with the name "ticker" and then I sent
> messages using routing_key like "instr1", "instr2", and so on.
> Unfortunately, on the receiver side I still receive all the messages.

http://qpid.apache.org/books/trunk/AMQP-Messaging-Broker-CPP-Book/html/ch01s06.html 
is the correct link to use for anything since the Qpid 0.10 release. The 
older content is now out of date and describes deprecated behaviour.

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


RE: Update message content

Posted by Davide Anastasia <Da...@qualitycapital.com>.
Hi Jakub,
Thanks a lot for your help: it really helped me a lot. However, I
couldn't find a way to filter messages using their subject. For
instance, I created my queue with the name "ticker" and then I sent
messages using routing_key like "instr1", "instr2", and so on.
Unfortunately, on the receiver side I still receive all the messages. 

Best,
Davide

-----Original Message-----
From: Jakub Scholz [mailto:jakub@scholz.cz] 
Sent: 29 February 2012 10:55
To: users@qpid.apache.org
Subject: Re: Update message content

Hi,

I think the last value queues may be helpful for you. It doesn't change
the message content, but it overwrites the older messages with new
messages in the queue based on a configured key. We are using it for
quite a similar scenario - distribution of some prices, where only the
last value for given financial product is important.

You may want to have a look at
http://qpid.apache.org/books/0.14/AMQP-Messaging-Broker-CPP-Book/html/ch
01s06.html,
where the LVQ functionality is described.

Regards
Jakub

On Wed, Feb 29, 2012 at 11:39, Davide Anastasia
<Da...@qualitycapital.com> wrote:
> Hi All,
>
> Suppose I have a queue where I receive prices for financial 
> instruments, where every instrument is a topic (instrument1, 
> instrument2, instrument3... so on) and I want to subscribe to this 
> queue (maybe to a subset of topics). However, I am not interested in 
> receiving all the messages, but only the last update: is there a way 
> to constantly change the content of a certain message (a certain topic

> in this case) so that a subscriber at a certain moment of time sees
only the last update?
>
>
>
> Best regards,
>
>
>
> Davide Anastasia
> Analyst, Research & Development
>
>
> Quality Capital Management Ltd.
> QCM House * Horizon Business Village
> No. 1 Brooklands Road
> Weybridge * Surrey KT13 0TJ
> United Kingdom
>
> Tel: +44 (0) 1932 334 400
> Fax: +44 (0) 1932 334 415
> Email: Davide.Anastasia@QualityCapital.com
> <ma...@QualityCapital.com>
>
> www.qualitycapital.com <http://www.qualitycapital.com/>
>
> ________________________________
>
> This email and any attachments are confidential and intended solely 
> for the use of the individual(s) to whom it is addressed.
>
> Any views or opinions presented are solely those of the author and do 
> not necessarily represent those of Quality Capital Management Ltd. If 
> you are not the intended recipient, be advised that you have received 
> this email in error and that any use, dissemination, printing, 
> forwarding or copying of this email is strictly prohibited. Please 
> contact the sender if you have received this email in error. You 
> should also be aware that emails are susceptible to interference and 
> you should not assume that the contents of this email originated from 
> the sender above or that they have been accurately reproduced in their

> original form. Quality Capital Management Ltd is authorised and 
> regulated by the Financial Services Authority in the UK and is a 
> member of the National Futures Association in the US.
>
> ________________________________
>
>
>

---------------------------------------------------------------------
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: Update message content

Posted by Jakub Scholz <ja...@scholz.cz>.
Hi,

I think the last value queues may be helpful for you. It doesn't
change the message content, but it overwrites the older messages with
new messages in the queue based on a configured key. We are using it
for quite a similar scenario - distribution of some prices, where only
the last value for given financial product is important.

You may want to have a look at
http://qpid.apache.org/books/0.14/AMQP-Messaging-Broker-CPP-Book/html/ch01s06.html,
where the LVQ functionality is described.

Regards
Jakub

On Wed, Feb 29, 2012 at 11:39, Davide Anastasia
<Da...@qualitycapital.com> wrote:
> Hi All,
>
> Suppose I have a queue where I receive prices for financial instruments,
> where every instrument is a topic (instrument1, instrument2,
> instrument3... so on) and I want to subscribe to this queue (maybe to a
> subset of topics). However, I am not interested in receiving all the
> messages, but only the last update: is there a way to constantly change
> the content of a certain message (a certain topic in this case) so that
> a subscriber at a certain moment of time sees only the last update?
>
>
>
> Best regards,
>
>
>
> Davide Anastasia
> Analyst, Research & Development
>
>
> Quality Capital Management Ltd.
> QCM House * Horizon Business Village
> No. 1 Brooklands Road
> Weybridge * Surrey KT13 0TJ
> United Kingdom
>
> Tel: +44 (0) 1932 334 400
> Fax: +44 (0) 1932 334 415
> Email: Davide.Anastasia@QualityCapital.com
> <ma...@QualityCapital.com>
>
> www.qualitycapital.com <http://www.qualitycapital.com/>
>
> ________________________________
>
> This email and any attachments are confidential and intended solely for
> the use of the individual(s) to whom it is addressed.
>
> Any views or opinions presented are solely those of the author and do
> not necessarily represent those of Quality Capital Management Ltd. If
> you are not the intended recipient, be advised that you have received
> this email in error and that any use, dissemination, printing,
> forwarding or copying of this email is strictly prohibited. Please
> contact the sender if you have received this email in error. You should
> also be aware that emails are susceptible to interference and you should
> not assume that the contents of this email originated from the sender
> above or that they have been accurately reproduced in their original
> form. Quality Capital Management Ltd is authorised and regulated by the
> Financial Services Authority in the UK and is a member of the National
> Futures Association in the US.
>
> ________________________________
>
>
>

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


Re: Update message content

Posted by William Henry <wh...@redhat.com>.
Yes. Use and LVQ.
https://cwiki.apache.org/qpid/lvq.html

William


On Feb 29, 2012, at 3:40 AM, "Davide Anastasia" <Da...@qualitycapital.com> wrote:

> Hi All,
> 
> Suppose I have a queue where I receive prices for financial instruments,
> where every instrument is a topic (instrument1, instrument2,
> instrument3... so on) and I want to subscribe to this queue (maybe to a
> subset of topics). However, I am not interested in receiving all the
> messages, but only the last update: is there a way to constantly change
> the content of a certain message (a certain topic in this case) so that
> a subscriber at a certain moment of time sees only the last update?
> 
> 
> 
> Best regards,
> 
> 
> 
> Davide Anastasia
> Analyst, Research & Development
> 
> 
> Quality Capital Management Ltd.
> QCM House * Horizon Business Village
> No. 1 Brooklands Road
> Weybridge * Surrey KT13 0TJ
> United Kingdom
> 
> Tel: +44 (0) 1932 334 400
> Fax: +44 (0) 1932 334 415
> Email: Davide.Anastasia@QualityCapital.com
> <ma...@QualityCapital.com> 
> 
> www.qualitycapital.com <http://www.qualitycapital.com/> 
> 
> ________________________________
> 
> This email and any attachments are confidential and intended solely for
> the use of the individual(s) to whom it is addressed. 
> 
> Any views or opinions presented are solely those of the author and do
> not necessarily represent those of Quality Capital Management Ltd. If
> you are not the intended recipient, be advised that you have received
> this email in error and that any use, dissemination, printing,
> forwarding or copying of this email is strictly prohibited. Please
> contact the sender if you have received this email in error. You should
> also be aware that emails are susceptible to interference and you should
> not assume that the contents of this email originated from the sender
> above or that they have been accurately reproduced in their original
> form. Quality Capital Management Ltd is authorised and regulated by the
> Financial Services Authority in the UK and is a member of the National
> Futures Association in the US. 
> 
> ________________________________
> 
> 
> 

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