3

I am using the cluster module and in each of the worker processes I need to publish certain values out to a single server, which subscribes to each worker.

I am using the zmq PUB socket in each worker process, but when each worker socket binds on the same port it causes a conflict and doesn't work. What socket pattern should I use so that I can publish/push/send values from my worker processes and subscribe to them with my server process?

Jason
  • 13,606
  • 2
  • 29
  • 40
Raja
  • 442
  • 5
  • 17

1 Answers1

2

Reverse the pub-sub bind-connect. Sub binds and Pub connects solves the problem.

Raja
  • 442
  • 5
  • 17
  • 1
    That falls over if you need more than one subscriber, which is a fairly common case. You can use the `xpub` and `xsub` sockets to build a proxy which will handle the more general n to n case. – david Jun 18 '14 at 05:11
  • Thanks David will have a look at it but my use-case is only a single sub. – Raja Jun 28 '14 at 05:45