carlosalbertomst
carlosalbertomst

Reputation: 513

ZeroMQ design decisions

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!

Upvotes: 8

Views: 2514

Answers (1)

Manuel Salvadores
Manuel Salvadores

Reputation: 16525

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

Upvotes: 4

Related Questions