NATS and JetStream

Presentations

NATS and JetStream

Intro

NATS components

NATS ecosystems support

Official

  1. C
  2. C#
  3. Elixir
  4. Go
  5. Java
  6. NGINX
  7. Node.js
  8. Python Asyncio
  9. Python Tornado
  10. Ruby
  11. TypeScript

Unofficial

  1. .NET
  2. Arduino
  3. Clojure
  4. Elm
  5. Erlang
  6. Haskell
  7. Lua
  8. MicroPython
  9. PHP
  10. Perl
  11. Python
  12. Python Twisted
  13. Qt5 C++
  14. Rust
  15. Scala
  16. Spring API
  17. Swift

Communication strategies

Overview of communication strategies

pub-sub communication pattern

NATS 01

Multiple producers to given subject

NATS 02

push-pull communication pattern via queue

NATS 03

All consumers work concurrently with same messages

NATS 04

Round-robin approach / load balancing

NATS 05

request-reply communication pattern

NATS 06

Streaming: push-push communication pattern

NATS 07

Streaming: push-pull communication pattern

NATS 08

Quality of service

Protocol used by NATS

Command   send by
INFO      server
CONNECT   client
PUB       client
SUB       client
UNSUB     client
MSG       server
PING      client and server
PONG      client and server
+OK       server
-ERR      server

Communicating with NATS

Live demo

cd /tmp/ramdisk/nats-0.0.34-linux-amd64/

./nats server run --jetstream

export PS1=$\ 

cd /tmp/ramdisk/nats-0.0.34-linux-amd64/

./nats stream create foo

./nats stream create bar

./nats stream rm foo

./nats stream rm bar

./nats stream ls

./nats stream create user-add-operation

./nats stream create user-delete-operation

./nats stream ls

./nats pub user.alice.add "Alice added"

./nats pub user.bob.add "Bob added too"

./nats pub user.clayton.delete "Clayton deleted"

./nats pub user.random.add "User #" --count=10

./nats sub --stream user-add-operation

./nats sub --stream user-add-operation --last

./nats sub --stream user-add-operation --new

Appendix

Czech articles about NATS