Life at the office
This is a fun little ZeroMQ example that simulates life at the office.
First, open up some terminals and fire up the boss and hr processes with
Next, fire up a worker process:
Now you can start bossing that worker around. In the boss's terminal, try typing
Notice that the worker happily obliges and the hr person happily logs what happened.
Next, have the boss request something complicated, and watch the worker struggle valiantly.
Notice that the boss asked for
somebody to do something complicated; there's
only one worker, so that's the only worker who does something complicated. Now
try firing up a few more worker processes in different terminals, and do some
more bossing. Notice that
somebody requests are equitably distributed amongst
the workers, while
everybody requests make it to every worker, no matter how
many there are and no matter when they started working!
brew install zeromq gem install zmq