ROUTER Error Handling
ROUTER sockets do have a somewhat brutal way of dealing with messages they canât send anywhere: they drop them silently. Itâs an attitude that makes sense in working code, but it makes debugging hard. The âsend identity as first frameâ approach is tricky enough that we often get this wrong when weâre learning, and the ROUTERâs stony silence when we mess up isnât very constructive.
Since ÃMQ v3.2, thereâs a socket option you can set to catch
this error: ZMQ_ROUTER_MANDATORY
. Set
that on the ROUTER socket, and when you provide an unroutable identity
on a send call, the socket will signal an EHOSTUNREACH
error.
Get ZeroMQ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.