[zeromq-dev] CZMQ 3.0.0rc1: Unexpected behavior with pub/sub and new zstr API

Pieter Hintjens ph at imatix.com
Thu Oct 23 23:29:50 CEST 2014


The inproc transport does connect immediately, however sending
messages still happens in the background, and this applies to
subscriptions as well. It is artificial to have subscriber and
publisher in the same thread. So it's not a problem in real code, only
in examples like yours.

On Thu, Oct 23, 2014 at 10:52 PM, Michaël Melchiore <rohel01 at gmail.com> wrote:
> Thank you for your answer.
>
> For the BYE messages, I thought using inproc transport would remove the need
> for hard coded sleeps.
>
> Michaël
>
> Le jeudi 23 octobre 2014, Pieter Hintjens <ph at imatix.com> a écrit :
>
>> There's a bug in zsock_new_sub() that I've just pushed a patch for.
>>
>> For the BYE messages, subscriptions flow asynchronously; if there's no
>> time for them to reach the PUB socket they aren't taken into effect.
>> If e.g, you add a sleep after the subscribe, it works as you expect.
>>
>> On Thu, Oct 23, 2014 at 1:17 PM, Michaël Melchiore <rohel01 at gmail.com>
>> wrote:
>>> Hello,
>>>
>>> I am using CZMQ 3.0.0rc1 with libzmq 4.1.0rc1 on a CentOS 6.4 box.
>>>
>>> In te following gist, I have written a quick and dirty program to
>>> experiment
>>> with some new API I discovered in CZMQ.
>>>
>>> There are some behaviors I cannot explain :
>>>
>>> On line 17, if I try to subscribe directly to "HELLO" in the
>>> zsock_new_sub
>>> call (commenting line 20), my subscription is never taken into account.
>>>
>>> On line 46, I use zsock_set_subscribe to register with "BYE" messages,
>>> but I
>>> do not receive them.
>>>
>>> What am I doing wrong ?
>>>
>>> Kind regards,
>>>
>>> Michaël
>>>
>>> _______________________________________________
>>> 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
>>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list