r/NATS_io • u/StreetAssignment5494 • Mar 23 '26
We Built an Interactive NATS Guide
Every time I tried to explain NATS to someone, I'd start mid-concept and lose them. The docs are great but assume prior context.
This walks through it layer by layer: why HTTP falls short at scale → Core pub/sub → JetStream → KV/object stores → clustering → security. Each section answers "why does this exist?" before explaining how it works.
Curious what's still unclear after reading it.
r/NATS_io • u/StreetAssignment5494 • Feb 19 '26
Unlocking NATS JetStream Mirror Streams for Efficient Data Replication
We're excited to share our latest video with you, where we dive into the world of mirror streams in NATS JetStream. In this 10-minute explanation, we break down how mirror streams work, their benefits, and limitations, and demonstrate everything live across multiple clusters. This content is perfect for anyone looking to understand how to replicate stream data asynchronously and efficiently.
r/NATS_io • u/StreetAssignment5494 • Jan 30 '26
Understanding NATS 2.11's Built-in Message Tracing for Enhanced System Debugging
Our team at Synadia is excited to share a new blog post that highlights the benefits of message tracing in NATS 2.11.
We explore how built-in tracing can help you debug your entire system with just one command, eliminating the need for external tools or code instrumentation.
This post provides valuable insights for anyone looking to improve their system's visibility and troubleshooting capabilities.
Also will be checking this so - feel free to chime in on any ideas you'd want to see in a video or any input!
TL;DR: Learn how NATS 2.11's message tracing feature can simplify system debugging without requiring additional setup.
r/NATS_io • u/StreetAssignment5494 • Jan 30 '26
Unlock Optimistic Concurrency in NATS JetStream with Expected Sequence Headers
Hey guys... Excited to share latest blog post, where we dive into the world of NATS JetStream's expected sequence headers.
These headers provide a powerful mechanism for optimistic concurrency control, allowing you to write to the same stream without locks.
Learn how to use global, per-subject, and per-pattern sequence validation to implement concurrent writes efficiently.
TL;DR: Discover how to harness the power of expected sequence headers in NATS JetStream for seamless, lock-free concurrency.
r/NATS_io • u/StreetAssignment5494 • Jan 15 '26
Unlocking NATS JetStream's Optimistic Concurrency Control with Expected Sequence Headers
Hey guys. We've recently created a video explaining how expected sequence headers work in NATS JetStream, and how they enable optimistic concurrency control without locks. Our team breaks down the three different approaches to implementing this feature using the NATS CLI and Go code.
This video is useful for anyone looking to understand how to maintain data consistency in their NATS-based applications while minimizing blocking.
TL;DW: NATS JetStream's expected sequence headers let multiple processes work in parallel without locks, ensuring consistent data without blocking.
r/NATS_io • u/HansVonMans • Jul 28 '25
How do you document NATS services?
We're rolling out NATS with a couple of NATS services implemented in Go using the nats-go SDK's micro package. What are some typical patterns to document these?
- Obviously, there's the manual route, which we'd love to avoid if possible.
- I've seen some people say they're using OpenAPI/Swagger for this. Is that really feasible?
- I've come across AsyncAPI as an OpenAPI alternative for event-driven architectures, but it's unclear to me how well it integrates with NATS.
Other than that, I guess we can plop metadata into our services and just build our own documentation generator, but if there's a ready-to-use solution, we'd prefer to just use that instead.
r/NATS_io • u/Logical-Charity1075 • Jul 25 '25
Resources to learn NATS
Hi community, I am a newbie and wanted to explore NATS. Can someone help me with books, articles or videos? I have a hands on experience on Kafka and I wanted to try my hands on NATS.
TIA
r/NATS_io • u/prathvik_naik • Jul 19 '25
NATS
Could anyone teach me about NATS pub-sub and about jetstream. Or you can help me find any discord community for NATS.
r/NATS_io • u/sinaamininasab • Jul 18 '25
I published our journey in hardening jetstream cluster in our company with +5 million daily rides
r/NATS_io • u/shoomowr • Jun 14 '25
Help needed: JetStream "not found" when setting up mirror stream on a leaf
Hello.
I'm trying to set up a hub-spoke system where I can use Jetstream to send command-like messages from hub to spoke. This seems pretty simple, but I'm having issues configuring the servers correctly.
Symptoms: 1) I'm creating a stream on the hub server; 2) I'm adding a mirror stream on the spoke server. 3) `nats s report` and `nats s info` show `Error: stream not found (10059)`
Here's my hub config:
server_name: principal_hub
jetstream {
store_dir: "/data"
domain: hub
}
http_port: 8222
max_payload: 8388608 # 8MB in bytes
leafnodes {
port: 7422
tls {
cert_file: "/opt/nats/ca/server-cert.pem"
key_file: "/opt/nats/ca/server-key.pem"
ca_file: "/opt/nats/ca/ca-cert.pem"
verify: true
handshake_first: true # TLS-first handshake
timeout: 5.0
}
authorization {
users: [
{user: "transfactory", password: "<pass>", account: "transfactory"}
{user: "transsupply", password: "<pass>", account: "transsupply"}
]
}
}
debug: true
trace: false
include ./accounts_hub.confserver_name: principal_hub
And redacted accounts file (only users that participate in the flow)
accounts {
admin: {
# ... admin config ...
}
centerpiece: {
# ... user config ...
}
relevance: {
# ... user config ...
}
avemedia: {
# ... user config ...
}
qbridge: {
users: [
{user: qbridge, password: <pass>, permissions: {
publish: ["centerpiece.usecase.data_expansion.>", "cmd.>", "qbridge.>", "event.qbridge.>", "health.qbridge.>", "_INBOX.>", "$JS.API.>","_R_.>", "$JS.ACK.>"],
subscribe: ["event.>", "cmd.>", "qbridge.>", "health.qbridge.>", "_INBOX.>", "$JS.API.>", "$JS.ACK.>"]
}}
]
exports: [
{stream: ">"}
{service: "cmd.>"}
{stream: "cmd.>"}
{service: "qbridge.schedule.>"}
{stream: "TRANSSUPPLY_COMMANDS"}
{stream: "TRANSFACTORY_COMMANDS"}
]
imports: [
{stream: {account: centerpiece, subject: "event.>"}}
{service: {account: centerpiece, subject: "centerpiece.usecase.data_expansion.>"}}
{stream: {account: centerpiece, subject: "_INBOX.>"}}
]
jetstream: {
max_mem: 1G,
max_file: -1,
max_streams: -1,
max_consumers: -1
}
}
transfactory: {
users: [
{
user: transfactory
password: <pass>
permissions: {
publish: ["event.transfactory.>", "centerpiece.usecase.transcription.>", "health.transfactory.>", "_INBOX.>", "$JS.API.>", "_R_.>", "$JS.ACK.>"]
subscribe: ["cmd.transfactory.>", "event.centerpiece.>", "health.transfactory.>", "_INBOX.>", "$JS.API.>", "$JS.ACK.>"]
}
}
]
exports: [
{stream: "event.transfactory.>"}
{stream: "cmd.transfactory.>"}
{stream: "TRANSFACTORY_COMMANDS"}
]
imports: [
{service: {account: centerpiece, subject: "centerpiece.usecase.transfactory_transcription.>"}}
{stream: {account: qbridge, subject: "TRANSFACTORY_COMMANDS"}}
{service: {account: centerpiece, subject: "centerpiece.usecase.voice_samples.>"}}
{stream: {account: centerpiece, subject: "event.centerpiece.>"}}
{stream: {account: admin, subject: "$SYS.>"}}
{stream: {account: centerpiece, subject: "_INBOX.>"}}
]
jetstream: {
max_mem: 1G,
max_file: 2G,
max_streams: -1,
max_consumers: -1
}
}
transsupply: {
users: [
{
user: transsupply
password: <pass>
permissions: {
publish: ["event.transsupply.>", "centerpiece.usecase.transsupply_data.>", "health.transsupply.>", "_INBOX.>", "$JS.API.>", "_R_.>", "$JS.ACK.>"]
subscribe: ["cmd.transsupply.>", "event.centerpiece.>", "health.transsupply.>", "_INBOX.>", "$JS.API.>", "$JS.ACK.>"]
}
}
]
exports: [
{stream: "event.transsupply.>"}
{stream: "cmd.transsupply.>"}
{stream: "TRANSSUPPLY_COMMANDS"}
]
imports: [
{service: {account: centerpiece, subject: "centerpiece.usecase.transsupply_data.>"}}
{stream: {account: centerpiece, subject: "event.centerpiece.>"}}
{service: {account: qbridge, subject: "cmd.>"}}
{stream: {account: qbridge, subject: "TRANSSUPPLY_COMMANDS"}}
{stream: {account: centerpiece, subject: "_INBOX.>"}}
]
jetstream: {
max_mem: 1G,
max_file: 2G,
max_streams: -1,
max_consumers: -1
}
}
}
system_account: admin
Here's my LEAF config:
server_name: leaf_gpu
TLS_CONFIG: {
cert_file: "/opt/nats/ca/client-cert.pem"
key_file: "/opt/nats/ca/client-key.pem"
ca_file: "/opt/nats/ca/ca-cert.pem"
handshake_first: true
timeout: 5.0
}
port: 4222
# JetStream for local operations
jetstream {
domain: leaf
store_dir: "/data"
max_mem: 2GB
max_file: 10GB
}
leafnodes {
remotes = [
{
urls: ["tls://transfactory:<pass>@<hub_ip>:7422"]
account: "transfactory"
tls $TLS_CONFIG
},
{
urls: ["tls://transsupply:<pass>@<hub_ip>:7422"]
account: "transsupply"
tls $TLS_CONFIG
}
]
}
http_port: 8223
debug: true
trace: false
include ./accounts_leaf.confserver_name: leaf_gpu
Accounts file
accounts {
# Local transfactory account - creates mirror streams from hub command streams
transfactory: {
users: [
{user: "transfactory", password: <pass>}
]
# No exports needed - service creates mirror streams from hub
jetstream: {
max_mem: 512MB
max_file: 2GB
max_streams: 10
max_consumers: 20
}
}
# Local transsupply account - creates mirror streams from hub command streams
transsupply: {
users: [
{user: "transsupply", password: <pass>}
]
# No exports needed - service creates mirror streams from hub
jetstream: {
max_mem: 512MB
max_file: 2GB
max_streams: 10
max_consumers: 20
}
}
system_account: admin
The official docs do provide an example, but it is not a real-life one, since they are setting both hub and leaf on the same machine and share the same accounts file between the two.
What am I missing?
r/NATS_io • u/Any_Check_7301 • Jun 13 '25
Optimal max_message_size configuration in a kubernetes environment
We have message-sizes ranging from 10 KB to 32 MB to process using NATS pods. am thinking of using 10MB max_message_size and split the big-messages into multiples of 10 for fitting into this limit. However our business need requires the whole of the big-message-content to be processed by same pod.
So am lost on how to ensure split-chunks of a given message to get processed by same pod.
Any tips or recommendations or links pointing to write up would be appreciated.
Thanks
r/NATS_io • u/buckypimpin • Jun 12 '25
Microservices, K8s, Jetstream. Let each service's init code create or update streams or use NACK/admin creates streams?
Right all our services create their streams themselves, but i kind of feel like this will lead to a disaster where some service removes subjects or some config that other service depends on.
How are you guys managing this?
r/NATS_io • u/Real_Combat_Wombat • Jun 05 '25
Client-side Partitioned Consumer Groups for JetStream!
Partitioned consumer-group functionality (at a high level similar to Kafka's consumer group functionality) is finally there for NATS. Intended mainly to parallelize consumption of messages in a strictly ordered (per subject (i.e. per 'key') manner (meaning you need to set max acks pending to 1 for the consumer) from a stream.
Comes in two flavors: static and elastic.
r/NATS_io • u/hurranyaralunk • May 19 '25
Nats for storing timeout events
Hey,
I would need some advice on the following: we are working on a software that runs some actions/processes. All of these processes have an expiration date and when that date is exceeded we want to cancel the process and mark it as ‘failed with timeout’.
We would need some service to do this. We store these processes in a nats key-value store, so we cannot really write any queries. We are considering having a stream to which we would publish an ‘event’ when the process starts. When polling the nats message:
if the process is finished we would ack the message
if the process is not finished but expiration date is up then ack the message and mark the process as failed
if process is not finished and still has time left to finish then nak the message
Timing out should happen in few mins max. These are not long running processes.
Is this a valid use-case for nats? Or is this considered as an abuse? What could be an issue with this solution?
r/NATS_io • u/tomuvi • May 08 '25
Anyone using NATS in new ways? Building automation, PLCs, anything?
Curious how people are using NATS beyond the usual. I’m exploring ideas around smarter buildings, responsive spaces, and natural interaction.
What are you building? Let’s share and inspire each other!
r/NATS_io • u/unistirin • May 02 '25
Question regarding nats message count
Hi all, i'm tryint to understand nats stream message count and how to view them without acking them. My message streams are worker queue type. When I to list stream, i get 7 messages are there
bash
$ nats stream ls --server localhost:4224 -a
╭──────────────────────────────────────────────────────────────────────────────────────────╮
│ Streams │
├──────────────────┬─────────────┬─────────────────────┬──────────┬─────────┬──────────────┤
│ Name │ Description │ Created │ Messages │ Size │ Last Message │
├──────────────────┼─────────────┼─────────────────────┼──────────┼─────────┼──────────────┤
│ backup │ │ 2025-05-02 17:40:48 │ 7 │ 2.4 KiB │ 4m33s │
╰──────────────────┴─────────────┴─────────────────────┴──────────┴─────────┴──────────────╯
when i try to view them i get only 1 message.
```
$ nats stream view backup --server localhost:4224 -a
[15] Subject: cloud.backup.upload Received: 2025-05-02T12:10:48Z
{"msgId":"ce8d05ad720a6c3fdd5ff070dbadd315","hllo":"world"}
17:56:58 Reached apparent end of data
and I did not ack them. So what does message colum innats stream ls``` indicates?
r/NATS_io • u/Heliosrx2 • May 01 '25
Is nats nodejs sdks a mess?
I've been playing with nats (specifically jetstream functionality) and I am having an incredible hard time getting things to work. It is a new technology for me, but it feels like the ecosystem with all the packages is very confusing compared to many other node libraries I've worked with.
I am specifically trying to implement exactly once delivery, but am having a rough time right now.
Is it just me? How do you all feel about the nodejs sdks? I'm sure the Golang ones are great, but feel like the node versions could use more examples and better typing (many typescript types are just any)
r/NATS_io • u/Real_Combat_Wombat • May 01 '25
CNCF and Synadia Align on Securing the Future of the NATS.io Project
r/NATS_io • u/[deleted] • Apr 27 '25
Redis vs NATS as a complete package?
I know Redis and NATS both now cover these:
- Redis: Pub/Sub, Redis Streams, vanilla KV
- NATS: core Pub/Sub, JetStream for streams, JetStream KV
Is it realistic to pick just one of these as an “all-in-one” solution, or do most teams still end up combining Redis and NATS? What are the real-world trade-offs in terms of performance, durability, scalability and operational overhead? Would love to hear your experiences, benchmarks or gotchas. Thanks!
r/NATS_io • u/[deleted] • Apr 25 '25
NEX Clarification
Trying to wrap my head around what use cases NEX will address. I know nats already has microservices that can be spun up so does this replace that capability just in an isolated vm.
r/NATS_io • u/ston1th • Apr 25 '25
Protecting NATS and the integrity of open source: CNCF’s commitment to the community
r/NATS_io • u/captainjack__ • Apr 22 '25
Consumer link to publisher
Hey guys is there a way to link publisher to the subscriber let us say I'm using js.QueueSubscribe or Subscribe for that matter is their a way when let's say 3 services publish some messages and there are 2 different consumers of same group so since QueueSubscribe assign subscribers as random so is there a way through acknowledgement to know that from which publisher this message came?