[zeromq-dev] Basic questions about PUB-SUB

Eric Hill eric at ijack.net
Fri Apr 26 15:21:21 CEST 2013


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> 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> 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> 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> wrote:
>>>
>>>> On Fri, Apr 26, 2013 at 2:19 PM, Nishant Mittal <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
>>>> 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
>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>
>>>
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> 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
> 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/0cd3d17d/attachment.htm>


More information about the zeromq-dev mailing list