[zeromq-dev] Basic questions about PUB-SUB

Parag Patel Parag.Patel at fusionts.com
Fri Apr 26 16:03:48 CEST 2013


I agree with this. This is something similar to what we're doing with our quotes and trades.

From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Nishant Mittal
Sent: Friday, April 26, 2013 9:58 AM
To: ZeroMQ development list
Subject: Re: [zeromq-dev] Basic questions about PUB-SUB

Eric, just had my coffee and have a better solution...
trades go with +AAPL
quotes go with -AAPL

then

a) everything:  subscribe to "+" and "-"
b) everything for a symbol (AAPL): subscribe to "+AAPL" and "-AAPL"
c) all trades for all symbols: subscribe to "+"
d) all quotes for all symbols: subscribe to "-"
e) trades only for a symbol AAPL: subscribe to "+AAPL"

right?

thanks
Nishant

On Fri, Apr 26, 2013 at 9:23 AM, Nishant Mittal <nmittal at rblt.com<mailto:nmittal at rblt.com>> wrote:
understood.. I appreciate your help with this.

thanks
Nishant

On Fri, Apr 26, 2013 at 9:21 AM, Eric Hill <eric at ijack.net<mailto:eric at ijack.net>> wrote:
Sorry, you are correct about a).  I missed the asterisk.

While the publisher can publish 2 copies, I like to separate concerns of the code.  In my opinion, the publisher should only publish what actually happened.  The duplication for the purposes of receiving the messages is a different feature and should not taint the publisher code.  Hence the broker.  You can have the broker live on the same machine if you'd like.  It's just a way to keep the code organized.


On Fri, Apr 26, 2013 at 8:18 AM, Nishant Mittal <nmittal at rblt.com<mailto:nmittal at rblt.com>> wrote:
Eric, then for a) i will have to subscribe to "*" otherwise i'll get all msgs twice. also why do I need a broker in the middle.. the publisher itself can publish 2 copies.. one with T (or Q) and the other with *..rt?

thanks
Nishant

On Fri, Apr 26, 2013 at 9:10 AM, Eric Hill <eric at ijack.net<mailto:eric at ijack.net>> wrote:
Place a broker between your publisher and subscribers.  Have your broker subscribe to every transaction your publishers send.  Publishers send every trade prefixed with T (TAAPL500.00) and every quote prefixed with Q (QAAPL).  Your broker re-publishes those, and also publishes the message replacing the type (first character) with an asterisk.  TAAPL500.00 -> *AAPL500.00 and QAAPL -> *AAPL.

Then:

a) everything - Subscribe to ""
b) everything for a symbol (AAPL) - Subscribe to "*AAPL"
c) all trades for all symbols - Subscribe to "T"
d) all quotes for all symbols - Subscribe to "Q"
e) trades only for a symbol AAPL - Subscribe to "TAAPL"


On Fri, Apr 26, 2013 at 7:45 AM, Nishant Mittal <nmittal at rblt.com<mailto:nmittal at rblt.com>> wrote:
Pieter thanks for the answers. on #3..
I am publishing market data (trades & quotes) for all symbols. the requirement is that a subscriber can subscribe to say
a) everything
b) everything for a symbol (AAPL)
c) all trades for all symbols
d) all quotes for all symbols
e) trades only for a symbol AAPL

the way I was hoping to "solve" this was by adding 2 extra frames to my payload frame. trades will be marked as "+", quotes with a "-".. so for example when publishing a trade for AAPL will send out...
frame 1: +AAPL
frame 2: AAPL
frame 3: <pay load>

similarily when publishing a quote ...
frame 1: -AAPL
frame 2: AAPL
frame 3: <pay load>

now for the above use cases the subscriber could subscribe to...
a) ""
b) "AAPL"
c) "+"
d) "-"
e) "+AAPL"

but if the filtering only looks at first frame this clearly wont work.. how do you suggest I achieve this?

thanks
Nishant

On Fri, Apr 26, 2013 at 8:34 AM, Pieter Hintjens <ph at imatix.com<mailto:ph at imatix.com>> wrote:
On Fri, Apr 26, 2013 at 2:19 PM, Nishant Mittal <nmittal at rblt.com<mailto:nmittal at rblt.com>> wrote:
> In a pub sub scenario in 3.2.2
> 1) does the filtering happen on the Publisher (i think yes) or the
> Subscriber?
Yes, the publisher filters.

> 2) does number of subscribers effect performance of the publishers (I think
> yes, as the pub has to filter/send msgs to all subscribers)
Not really, your network will saturate before the publisher is affected.

> 3) I send out 3 part msgs.. 1st 2 parts are really for filtering and the 3rd
> part is a binary object.. when I subscribe.. would zeromq try to match with
> all 3 parts?..
No. the match stops at the end of the first frame in the worst case
(and stops when it mismatches a single octet anyhow).

-Pieter
_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org<mailto:zeromq-dev at lists.zeromq.org>
http://lists.zeromq.org/mailman/listinfo/zeromq-dev



--
Nishant Mittal
Director, Product Development
Rosenblatt Securities Inc.
20 Broad Street
New York, NY 10005

Direct: 212-607-3159
Mobile: 646-504-2629

_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org<mailto:zeromq-dev at lists.zeromq.org>
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org<mailto:zeromq-dev at lists.zeromq.org>
http://lists.zeromq.org/mailman/listinfo/zeromq-dev



--
Nishant Mittal
Director, Product Development
Rosenblatt Securities Inc.
20 Broad Street
New York, NY 10005

Direct: 212-607-3159
Mobile: 646-504-2629

_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org<mailto:zeromq-dev at lists.zeromq.org>
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org<mailto:zeromq-dev at lists.zeromq.org>
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130426/311e1d25/attachment.htm>


More information about the zeromq-dev mailing list