16 April, 2011
The current version of the Guide has a lot of changes to the examples. In this page I'll explain them, so that you can decide if and how to update the examples in your language.
The main reason for these changes was to port the C code examples onto czmq. This is the high-level C API, and it replaces the various classes I was using (like zmsg.h, zlist.h, zhash.h), as well as most of zhelpers.h.
- I've removed XREP and XREQ in the code and replaced with ROUTER and DEALER.
- All version asserts are gone from the code.
- zversion.c is renamed to version.c.
- Removed zmsg, zlist, zhash, as these are provided by czmq.
- Stripped down zhelpers to remove all code that's also in czmq.
- PPP (http://rfc.zeromq.org/spec:6) changed to use binary commands. READY is 0x01, HEARTBEAT is 0x02. The ppqueue example has been modified accordingly.
- spworker uses 3 seconds (instead of 5) to simulate an overload. 5 seconds was too long for clients to recover.
- ppworker uses automatic identities instead of explicit ones, since durable sockets are now considered 'bad practice' in 0MQ.
- lruqueue3 shows how to use the czmq 'zloop' reactor. I'd assume similar reactors are useful in other languages. See zloop class in czmq.
- bstar wraps the Binary Star core as a reactor, layered over zloop. The bstarsrv2 example demonstrates how to use this.
- There are new examples for the Clone pattern: clonecli4, clonecli5, clonecli6, clonesrv4, clonesrv5, clonesrv6, clone.
- There is a new kvsimple class that is very close to kvmsg but stripped down for the simpler Clone models.
Porting onto czmq
- These examples now use czmq: asyncsrv, peering1, peering2, peering3, lpclient, spqueue, spworker, ppqueue, ppworker, mdcliapi, mdclient, mdwrkapi, mdworker, mdbroker, mdcliapi2, mdclient2, tripping, mmiecho, ticlient, titanic, bstarsrv, bstarcli, flclient1, flserver1, flclient2, flserver2, flclient3, flserver3, flcliapi, clonecli1, clonesrv1, kvmsg, clonecli2, clonesrv2, clonecli3, clonesrv3.
- When using czmq, examples exit if zmq_poll returns -1.
- When using czmq, all examples exit if Ctrl-C is used.