NATS
Pub/Sub Commands
Publish and subscribe to NATS subjects for real-time messaging. Learn core pub/sub patterns, wildcards, request/reply, and queue groups for load balancing.
7 commands
Pro Tips
Use 'nats sub "events.>"' to subscribe to all events using the '>' wildcard for multi-level matching.
Use 'nats request service.ping "hello"' for request/reply patterns — waits for a single response.
Use '--queue mygroup' on subscribers for load balancing — only one subscriber per group gets each message.
Common Mistakes
Core NATS is fire-and-forget with no persistence. Use JetStream if you need guaranteed delivery.
Wildcards '*' matches one token, '>' matches one or more. 'events.*' won't match 'events.user.created'.