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.
NATS namespaces
You can easily create a NATS namespace from the Scaleway console, via the Scaleway API or via Terraform.
NATS credentials
When you create your NATS namespace, you next need to create credentials. On the NATS side, your namespace is the equivalent of an ‘account’, and your credentials are the equivalent of a ‘user’. We configured Scaleway Messaging and Queuing to 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 namespace, but does not enable you to generate new users with specific right 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 following tools:
NATS CLI
The NATS CLI is a great tool for administrating or testing your subjects and streams. See our dedicated documentation to help get 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 |
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 Messaging and Queuing 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.