If you use ZMQ in C/C++, be sure to check this out.
Why use this, u say?The advantage is that msg_single_t/msg_multi_t objects on the stack get cleaned up automatically. It helps to clean up a lot of boilerplate code.
zmq_msg_t msg; zmq_msg_init(&msg); zmq_msg_init_size(&msg, sizeof(int)); int payload = zmq_msg_recv(&msg, zpipe, 0); zmq_msg_close(&msg);
Can now be replaced by
msg_single_t msg(sizeof(int)); int payload = msg.recv(zpipe, 0);
Closing the msg is done for you when msg goes out of scope. This helps to reduce memory leaks / zmq errors due to not closing the message properly. Pretty, pretty code!