A standalone course · Catch up on this repo + interview prep
NATS JetStream, from newcomer to interview-ready
The eventing bus your own services live on — how a domain event fans out from one service to another, durably, with tenancy and tracing intact.
Your services — conversationmgmt and notification — wake up to
NATS events all day: a user is created, a staff record changes, a notification is requested. This
course is the bus underneath them: core NATS pub/sub, the JetStream
persistence model (streams, durable consumers, acknowledgements), the golibs/nats
wrapper, and the subscribers you actually own. It's the eventing half of the platform (Kafka is the
other half — and we'll compare them), and it's grounded in your real code.
resource_path and the trace context through the message envelope and
re-injects them on the consumer. That trick (Lesson 7) is the cleverest bit of the whole layer.
Part 1 — Core NATS & the JetStream model available now
What NATS is, and the persistence model JetStream layers on top.
1 · The NATS map
Core NATS vs JetStream, NATS vs Kafka, and where the pieces sit in this repo.
ready2 · Subjects & pub/sub
The dotted subject hierarchy, wildcards, and queue-group load balancing.
ready3 · JetStream & streams
Persistence, retention policies, storage & replicas — provisioned by fink.
ready4 · Consumers
Push vs pull, durable vs ephemeral, ack policy — and QueueSubscribe.
Part 2 — Publishing, consuming & delivery available now
The golib wrapper — how a message is published, consumed, and made reliable.
5 · The golib & the connection
The JetStreamManagement interface, lazy connect, reconnect.
6 · Publishing
The DataInMessage envelope, dedup by Nats-Msg-Id, traced publish.
7 · Subscribing & the handler
handleMsg — where tenancy & tracing survive the async hop.
8 · Delivery semantics
At-least-once, ack/nak/term, redelivery, dedup — and the gaps.
readyPart 3 — The repo in practice available now
Your own subscribers, the publish link between your services, and the whole picture.
9 · conversationmgmt subscribers
User.Created, Staff.Upserted, UserGroup.Upserted.
10 · notification & the publish link
Notification.Created, and the transport-agnostic handler.
11 · The activity-log firehose
Interceptors publish; zeus is the one pull consumer.
ready12 · NATS vs Kafka + ops
When each, the migration, ops & testing — and the recap.
readyReference shelf
Cheat sheet
The flow, streams/consumers config, handleMsg + interview one-liners.
Glossary
The canonical vocabulary, mapped to interview terms.
Repo NATS map
Ground truth: the golib, streams, subscribers, activity log, ops — with file:line.
Resources
docs.nats.io, nats.go, Synadia — high-trust sources only.