nsq.io – a realtime distributed messaging platform (and written in Go)
TL;DR nsqd <——> nsqlookupd <——> nsq clients
nsqd – the daemon that receives, queues, and delivers messages to clients.
- processes messages produced by nsq clients
- registers itself to nsqlookupd
- by default, listens on port 4150 (for TCP clients), 4151 (for HTTP clients)
- receives messages
- queue and re-queue messages
- broadcast topics and channels to nsqlookupd
nsqlookupd – the daemon that manages topology information.
- clients query
nsqdproducers for a specific topic information
- by default, listens on port 4160 (for TCP clients), 4161 (for HTTP clients)
- must have static IP address as much as possible
- no need for etcd, Consul or Zookeeper
- must be run in the same machine (physical or virtual) as nsqd
- HTTP – nsqd has a built-in Web server (as of this moment, uses httprouter)
- registers itself to nsqlookupd (for scalability)
- clients are apps that produce or consume messages (can be both at the same time) to and from nsqd
Of course, there is nsqadmin and some utilities but the above-mentioned information is the minimum you need to know about NSQ
With the advent of Docker 1.12 in swarm mode, getting NSQ cluster up and running is made easier and more robust, made possible by ideas from Borg and Kubernetes from Google.
For Go examples using NSQ, visit my GitHub repo at https://github.com/ibmendoza/go-examples