Slide 22
Slide 22 text
In memory vs db for NATS Streaming
If you use a NATS Streaming server with memory store, it is true that if the
server is restarted, since no state is being restored, the previously
"connected" clients will stop receiving messages. Publishers would fail too
since the server would reject published messages for unknown client IDs.
The streaming server and streaming clients communicate through some
inboxes. When the Streaming server is restarted, since it lost that
knowledge, it can't communicate with existing clients. Moreover, even
internal subjects used to communicate between the server and its clients
contain a unique id that won't be the same after the restart).
Note: If the NATS Streaming server connects to a non-embedded NATS
Server, then if the NATS Server itself is restarted, that is fine, the client
library's use of the underlying NATS connection will reconnect and
everything would work fine (some timeout may occur for the operations that
were inflight when the NATS server was restarted). This is because the
Streaming server would still be running and its state maintained, so the
communication can continue.
https://github.com/openfaas/nats-queue-worker/pull/17#issuecomment-377000157