NATS supports a form of load balancing using queue groups. Subscribers register a queue group name. A single subscriber in the group is randomly selected to receive the message.
Go and the NATS server should be installed.
nats-server
go get github.com/nats-io/nats.go
git clone https://github.com/nats-io/nats.js.git
git clone https://github.com/nats-io/nats.rb.git
cd $GOPATH/src/github.com/nats-io/nats.go/examples
go run nats-qsub/main.go foo my-queue
npm install nats
cd nats.js/examples
node node-sub foo my-queue
gem install nats
nats-queue foo my-queue &
cd $GOPATH/src/github.com/nats-io/nats.go/examples
go run nats-sub/main.go foo
cd $GOPATH/src/github.com/nats-io/nats.go/examples
go run nats-pub/main.go foo "Hello NATS!"
You should see that the publisher sends the message: Published [foo] : 'Hello NATS!'
You should see that only one of the my-queue group subscribers receives the message. In addition, the Go client subscriber not in the my-queue group should also receive the message.
go run nats-pub/main.go foo "Hello NATS Again!"
You should see that a different queue group subscriber receives the message this time, chosen at random among the 3 queue group members.