Both of these small experiments come from the same week of July 2012.
queue-process: a Redis queue consumer#
queue-process is a multithreaded C++ client that pops events from a Redis list with a blocking BLPOP and hands them over to a worker, with two Boost threads sharing the work through a mutex and a condition variable. I wrapped the Redis client to catch connection errors and retry every second, so the consumer survives Redis restarts. Source.
req-rep: ZeroMQ between C++ and Python#
This one is a ZeroMQ request-reply pair. On the C++ side the server dispatches three-letter commands through a command map, where GET returns the current message together with the message ID and ACK<id> confirms that message and moves on to the next one. The client is written in Python with Twisted and txZMQ to loop GET and ACK, but if anything goes wrong (a timeout, for example), it tears down the socket and starts all over again. Source.