- It generates regular sockets and uses the unixy socket APIs.
- It handles connections automatically. What you really do is announce your desire to have a connection with
ctx.connect(type, link, handler). If there is no accepting socket at that location(link) then it will continue to try to establish a connection in the eventloop. Hence, it doesn't matter whether the server or client starts first.
linkdescription contains three items in a URL style string.
link = proto://address:portie "tcp://localhost:3000". Protocols include 'tcp', 'udp', 'inproc', 'ipc', 'pgm' and 'epgm'. 'tcp' and 'udp' are obvious. 'inproc' is an internal to a process memory space pseudo-socket (for thread interop). 'ipc' is Unix file sockets ala
/tmp/mysql.sock. And the 'pgm' types are named for a library that does multicast sockets.
- Then there was framing. All messages are sent a arbitrarily sized opaque blobs. Each message on the wire is a length and a stream of bytes.
sk.send("foo")sends 3 bytes (no null term unless you intentionally send that). There is a small addendum to this
method, in that it can send many parts inside a single "message", there is a SENDMORE flag with each lowlevel send() call and no SENDMORE flag on the last send() call.
- Lastly there is a
typeargument of the
ctx.connect()call. This sets the "Messaging Pattern" used on the socket. The messageing patterns determine where and how many copies of the message are sent, which messages are recieved versus ignored, and Queueing policy. This is the area I need to delve into deeper. But some patterns are intuitively usable; for instance REQ/REP, PUB/SUB (subsciption topics are trival to the point of lame).
Thursday, May 12, 2011
I have been experimenting with ZeroMQ
It is a good library in several ways:
It was created as the simple alternativ to AMQP.