NATS Overview
What is NATS?
NATS (Neural Autonomic Transport System) is a messaging system that aims to be simple to use, scalable and provide high performance. It implements a publish/subscribe model as well as adding a streaming service via JetStream. A stream is a persistent, time-ordered list of messages which can be read sequentially by consumers. A consumer can be thought of as a “cursor” in the stream, consuming the stream’s messages according to their “subject filter” or “replay policy”. With NATS, you would typically implement a queue as a stream with a single consumer to read from.
NATS is a Cloud Native Computing Foundation project supported by a strong community, and can also be integrated in a Kubernetes cluster.
Scaleway NATS
Scaleway NATS is a managed messaging service that enable seamless communication between distributed applications, which leverages the NATS protocol.
NATS accounts
You can easily create a NATS account from the Scaleway console, via the Scaleway API or via Terraform.
NATS credentials
When you create your NATS account, you next need to create credentials. On the NATS side, these credentials are the equivalent of a ‘user’. We use the most secure connection type offered by NATS: NKeys. NKeys are a public-key signature system based on Ed25519.
Your credentials are provided in the form of a downloadable .creds
file. Each set of credentials gives you full access to your NATS account, but does not enable you to generate new users with specific rights or fine-grained permissions.
Further actions: NATS CLI & NATS SDK
All further actions related to publishing, processing and managing messages, subjects and streams can be done via one of the tools described below.
Note that the Scaleway NATS server is configured with TLS, and as such will require all clients to connect with TLS. In the case of the NATS SDK however, the SDK abstracts this and handles the TLS connection itself.
NATS CLI
The NATS CLI is a great tool for administrating or testing your subjects and streams. See our dedicated documentation for help getting started with the NATS CLI.
NATS SDK
NATS has a wide range of language compatibility:
Language | Links |
---|---|
Golang | nats.go, godoc |
Java | nats.java, javadoc, examples |
C# | nats.net, doxygen, package |
JavaScript | Node.js, deno, WebSocket |
Python | nats.py, doc |
Ruby | nats-pure.rb, yard |
C | nats.c, doc |
Rust | nats.rs, doc |
Elixir | nats.ex, doc |
Zig | nats.zig |
PHP | phpnats nats.php |
Further community NATS SDKs, e.g. SwiftyNats, Kotlin and Crystal, can be found here.
The following documents may help you get started using the above SDKs:
The main difference you will find between the standard NATS documentation and Scaleway NATS is that we require you to provide a specific NATS URL and credentials to access the service. Refer to our developers documentation for further information.
NATS resources
- Official NATS Documentation: What is NATS?
- Create a serverless architecture for handling large messages using Scaleway’s NATS, Serverless Functions, and Object Storage
- Publish/Subscribe in pure NATS (no message retention)
- Introduction to JetStream
- Learn NATS by Example
- How to use Scaleway NATS with the Terraform NATS Jetstream provider