[zeromq-dev] Dynamic subscriptions

James Connor James.Connor at tibra.com
Mon Jan 10 07:38:14 CET 2011

I'm sure this is a common problem but I'm unsure of the 'best' way to solve it.

I am working in C# and have a SUB socket which is listening to changing subscription topics.

I have a dedicated thread which creates and owns the subscription socket (subSocket) and contains a while(true) loop context.Poll(...) setup which is firing a handler method through a PollItem when messages are received.  However, I want to change the subscriptions at runtime (from another thread) and since this sub thread is now busy waiting, I cannot access the subSocket object to call the .Subscribe("2ndSubTopic", Encoding.Unicode) method without interrupting my context.Poll - unless I break the thread ownership.

Is there a good way to do this?

James Connor
Software Developer | Tibra Global Services
*: james.connor at tibra.com<mailto:james.connor at tibra.com>
*: +61 (0)28 669 1269

Tibra Trading Europe Limited is Authorised and Regulated by the FSA (Company No. 06061713)
Tibra Global Services Pty Limited London Branch (Company No. BR014370)
Tibra Equities Europe Limited (Company No. 07283912)
Registered in England & Wales - Level 11, 5 Aldermanbury Square London EC2V 7HR

The contents of this email including any attachments are confidential. If you have received this email in error, please advise the sender by return email and delete this email. Any unauthorised use of the contents of the email is prohibited and you must not disseminate, copy or distribute the message or use the information contained in the email or its attachments in any way.

The views or opinions expressed are the author's own and may not reflect the views or opinions of Tibra. Tibra does not guarantee the integrity of any emails or attached files. E-mails may be interfered with, may contain computer viruses or other defects. Under no circumstances do we accept liability for any loss or damage which may result from your receipt of this message or any attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110110/474903b6/attachment.htm>

More information about the zeromq-dev mailing list