go build worker.go
go build sender.go
Start gnatsd
server and 3 worker processes. Then run test to send 3 messages at once.
It is expected that all 3 messages are picked up by 3 idle workers, and this may happen on
the first run. Re-running the send test results in one of the workers not picking up a message
and another worker handles 2 consecutive messages.
shell 1
gnatsd -p 23456
shell 2,3,4
./worker
shell 5
python ./send.py
# output
started subprocess
started subprocess
started subprocess
[None, None, None]
[None, None, None]
[None, None, None]
[None, None, None]
[None, None, None]
2019/01/11 17:36:58 Received: 2019-01-11 17:36:58.929140694 +1300 NZDT m=+222.514945473
2019/01/11 17:36:58 Received: 2019-01-11 17:36:58.929872619 +1300 NZDT m=+221.086229133
[0, 0, None]
[0, 0, None]
[0, 0, None]
[0, 0, None]
[0, 0, None]
2019/01/11 17:37:03 Received: 2019-01-11 17:37:03.930106351 +1300 NZDT m=+226.086462907
[0, 0, 0]