In a REQ/REP socket, if the socket send a request to a dead (disconnected) node the message isn't delivered and stays in a message queue occupying memory. How can one clean these undelivered messages (let's say, messages that are in the queue for more than 1 minute)?
Thanks!
ZeroMQ is a library used to implement messaging and communication systems between applications and processes - fast and asynchronously.
The ZeroMQ Message Transport Protocol (ZMTP) is a transport layer protocol for exchanging messages between two peers over a connected transport layer such as TCP. This document describes ZMTP/2.0. In theory, ZMTP should define fully interoperable behavior between implementations.
ZeroMQ (also spelled ØMQ, 0MQ or ZMQ) is an asynchronous messaging library, aimed at use in distributed or concurrent applications. It provides a message queue, but unlike message-oriented middleware, a ZeroMQ system can run without a dedicated message broker; the zero in the name is for zero broker.
To begin, instead of being stream (TCP), or datagram (UDP) oriented, ZeroMQ communication is message-oriented. This means that if a client socket sends a 150kb message, then the server socket will receive a complete, identical message on the other end without having to implement any explicit buffering or framing.
You might want to set the optional parameter ZMQ_LINGER
:
The ZMQ_LINGER option shall set the linger period for the specified socket. The linger period determines how long pending messages which have yet to be sent to a peer shall linger in memory after a socket is closed with zmq_close(3), and further affects the termination of the socket's context with zmq_term(3).
... for which a positive value will set a maximun time for message to be blocked in the queue.
See http://api.zeromq.org/2-1-1:zmq-setsockopt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With