I'm using reactphp/zmq.
How can I have multiple push workers within multiple pull workers, is that possible?
A only can have multi pull and single push, as in README's example:
$push->connect()
$pull->bind()
Or single pull and multi pushes:
$push->bind()
$pull->connect()
When I try to set both as connect
the pulls doesn't receive the messages.
Otherwise, trying to start more than one process with bind
it throws:
ZMQSocketException: Failed to bind the ZMQ: Address in use
Should I have a middleware? 🤔
(5555) (5556)
push -| (5555) > (5556) |- pull
push -|-> pull & push <- |- pull
push -| bind / bind |- pull
connect connect
Aha! Thank you very much @Mjh for clarifying things.
Turns out that I do need something in the middle that should be a message queue broker and ZMQ does have something for that. Internally calling zmq_proxy
starts a rrbroker
loop, unfortunately theses guys aren't abstracted at reactphp/zmq, but they are at ext-php through ZMQDevice
.
Source: http://zguide.zeromq.org/php:chapter2#ZeroMQ-s-Built-In-Proxy-Function