Open
Description
According to zmq doc ZMQ_LINGER: "The value of 0 specifies no linger period. Pending messages shall be discarded immediately when the socket is closed with zmq_close()."
So here is my example:
# fpm-script
$context = new ZMQContext();
$socket = $context->getSocket(ZMQ::SOCKET_PUSH);
$socket->setSockOpt(ZMQ::SOCKOPT_LINGER, 0);
$socket->connect("tcp://127.0.0.1:5555");
$socket->send('test');
# cli script
$context = new \ZMQContext();
$pull = $context->getSocket(ZMQ::SOCKET_PULL);
$pull->bind('tcp://127.0.0.1:5555');
while (true) {
var_dump($pull->recv());
}
The magic is random msg delivery (like 1 of 5) while there is not (I guess) zmq_close() call inside fpm-script. And it delivers nothing after cli script rerun that is correct behaviour.
Metadata
Metadata
Assignees
Labels
No labels