Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
<pre id="{{$n}}_{{.Language}}_content"><a class="toolbar-icons pull-right" target="_blank" href="{{.RepoURL}}"><i class="mdi mdi-github-circle" title="View on GitHub"></i></a><a class="toolbar-icons pull-right"><i class="mdi mdi-content-copy js-copy" title="Copy to Clipboard"></i></a><span class="copy-msg pull-right"></span><code class="{{.SyntaxClass}}">{{.Content}}</code></pre>
</div>
{{end}}
</div>
</div>
2 changes: 1 addition & 1 deletion howto-examples/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Examples will be roughly classified as:
* **Complex** - A non-trivial setup requiring some prior knowledge of NATS - e.g. Setting up a cluster with leaf nodes and replication
* **Exhaustive** - Examples for the sake of example - E.g. Demonstrating all retention and limit options of a stream

Last but not least: LLVMs learn by example. Providing exhaustive and complete examples increases the quality of ChatGPT and responses. Content matters more than structure for this purpose.
Last but not least: LLMs learn by example. Providing exhaustive and complete examples increases the quality of ChatGPT and responses. Content matters more than structure for this purpose.

## Programming examples and Client APIs

Expand Down
2 changes: 1 addition & 1 deletion nats-concepts/jetstream/consumers.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ While **Streams** are responsible for storing the published messages, the consum
This tracking ensures that if a message is not acknowledged (un-acked or 'nacked'), the consumer will automatically attempt to re-deliver it. JetStream consumers support various acknowledgment types and policies. If a message is not
acknowledged within a user-specified number of delivery attempts, an advisory notification is emitted.

## Dispatch type - Pull / Push
## Dispatch type - Pull / Push
Consumers can be **push**-based where messages will be delivered to a specified subject or **pull**-based which allows clients to request batches of messages on
demand. The choice of what kind of consumer to use depends on the use-case.

Expand Down
2 changes: 1 addition & 1 deletion nats-concepts/jetstream/streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ A common use case for rollup is for state snapshots, where the message being pub

If enabled, the `RePublish` stream option will result in the server re-publishing messages received into a stream automatically and immediately after a successful write, to a distinct destination subject.

For high scale needs where, currently, a dedicated consumer may add too much overhead, clients can establish a core NATS subscription to the destination subject and receive messages that were appended to the stream in real-time.
For high scale needs where, currently, a dedicated consumer in JetStream may add too much overhead, clients can establish a core NATS subscription to the destination subject and receive messages that were appended to the stream in real-time.

The fields for configuring republish include:

Expand Down
4 changes: 2 additions & 2 deletions nats-concepts/overview/compare-nats.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: 'NATS Comparison to Kafka, Rabbit, gRPC, and others'

This feature comparison is a summary of a few of the major components in several of the popular messaging technologies of today. This is by no means an exhaustive list and each technology should be investigated thoroughly to decide which will work best for your implementation.

In this comparison, we will be featuring NATS, Apache Kafka, RabbitMQ, Apache Pulsar, and gRPC.
In this comparison, we will be featuring NATS, Apache Kafka, Rabbit, Apache Pulsar, and gRPC.

## Language and Platform Coverage

Expand Down Expand Up @@ -126,7 +126,7 @@ In this comparison, we will be featuring NATS, Apache Kafka, RabbitMQ, Apache Pu
| **gRPC** | There are a number of third party integrations including HTTP, JSON, Prometheus, Grift and others. [_\(3\)_](compare-nats.md#references)__ |
| **Kafka** | Kafka has a large number of integrations in its ecosystem, including stream processing \(Storm, Samza, Flink\), Hadoop, database \(JDBC, Oracle Golden Gate\), Search and Query \(ElasticSearch, Hive\), and a variety of logging and other integrations. |
| **Pulsar** | Pulsar has many integrations, including ActiveMQ, Cassandra, Debezium, Flume, Elasticsearch, Kafka, Redis, and others. |
| **Rabbit** | RabbitMQ has many plugins, including protocols \(MQTT, STOMP\), WebSockets, and various authorization and authentication plugins. |
| **Rabbit** | Rabbit has many plugins, including protocols \(MQTT, STOMP\), WebSockets, and various authorization and authentication plugins. |

## References

Expand Down
4 changes: 2 additions & 2 deletions nats-concepts/subject_mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Legend: Client: --C Router: --> Gateway: ==> Leafnode: ~~> JetStream: --J Error:
Egress Count:

JetStream: 1
````
```
{% endhint %}


Expand Down Expand Up @@ -187,7 +187,7 @@ A full wildcard token can be used ONCE in source expression and must be present
Example: Prefixing a subject:
```
nats server mapping ">" "baz.>" bar.a.b
> baz.bar.b.a
> baz.bar.a.b
```


Expand Down
8 changes: 4 additions & 4 deletions nats-concepts/subjects.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ service.deploy.server-acme.app123
* Name business or physical entities. Refrain from encoding too much data into the subject.
* Encode (business) intent into the subject, not technical details.

Pragmatic:
Pragmatic:

````shell
orders.online.store123.order171711
````

Maybe not so useful:
Maybe not so useful:

````shell
orders.online.us.server42.ccpayment.premium.store123.electronics.deliver-dhl.order171711.create
Expand Down Expand Up @@ -141,7 +141,7 @@ The rules and recommendations here apply to ALL system names, subjects, streams,

* **Reserved names:** By convention subject names starting with a `$` are reserved for system use (e.g. subject names starting with `$SYS` or `$JS` or `$KV`, etc...). Many system subjects also use `_` (underscore) (e.g. _INBOX , KV_ABC, OBJ_XYZ etc.)

Good names
Good names

```markup
time.us
Expand All @@ -158,7 +158,7 @@ $location.Stockholm
_Subjects_.mysubject
```

Forbidden stream names
Forbidden **stream** names

```markup
all*data
Expand Down
6 changes: 3 additions & 3 deletions nex/getting-started/building-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ this is a test
Finally, let's also make sure that this service is behaving properly according to the NATS services specification:

```
$ nats micro ls
$ nats service ls
╭──────────────────────────────────────────────────────────────╮
All Micro Services │
All Services
├─────────────┬─────────┬────────────────────────┬─────────────┤
│ Name │ Version │ ID │ Description │
├─────────────┼─────────┼────────────────────────┼─────────────┤
│ EchoService │ 1.0.0 │ FKIuiivKgSB8VWyjDYBpEc │ │
│ EchoService │ 1.0.0 │ 8GGpcCv98xgoGb5VUDRAl8 │ │
╰─────────────┴─────────┴────────────────────────┴─────────────╯
```

Expand Down
2 changes: 1 addition & 1 deletion ngs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ You can then follow the instructions to obtain your NGS account, and create the

## Connecting to NGS

Your isolated applications can connect directly to NGS, or if you have more than one process running in the same location they would connect to NGS through a Leaf Node nats server that you would deploy locally and that would act as a 'local router' and proxy for the local applications to NGS. Those client applications (and the Leaf Node nats servers if used) only need to use "nats://connect.ngs.global" or "tls://connect.ngs.global" as the connection URL and the user's credential file which contains both the private key and the JTW to the user.
Your isolated applications can connect directly to NGS, or if you have more than one process running in the same location they would connect to NGS through a Leaf Node nats server that you would deploy locally and that would act as a 'local router' and proxy for the local applications to NGS. Those client applications (and the Leaf Node nats servers if used) only need to use "nats://connect.ngs.global" or "tls://connect.ngs.global" as the connection URL and the user's credential file which contains both the private key and the JWT to the user.
2 changes: 1 addition & 1 deletion reference/nats-protocol/nats-protocol/nats-client-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type Msg struct {
}
```

A NATS publisher publishes the data argument to the given subject. The data argument is left untouched and needs to be correctly interpreted on the receiver. How the client parses a NATS message depends on the programming language.
A NATS publisher publishes the `Data` argument to the given subject. The data argument is left untouched and needs to be correctly interpreted on the receiver. How the client parses a NATS message depends on the programming language.

## Deciding on a parsing strategy

Expand Down
2 changes: 1 addition & 1 deletion running-a-nats-service/configuration/leafnodes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ nsc reply q 42
And now let's make the request from the local host:

```bash
nats-req q ""
nats req q ""
```

```text
Expand Down
2 changes: 1 addition & 1 deletion running-a-nats-service/configuration/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ For example, you could configure `logrotate` with:

The first line specifies the location that the subsequent lines will apply to.

The rest of the file specifies that the logs will rotate daily ("daily" option) and that 30 older copies will be preserved ("rotate" option). Other options are described in [logrorate documentation](https://linux.die.net/man/8/logrotate).
The rest of the file specifies that the logs will rotate daily ("daily" option) and that 30 older copies will be preserved ("rotate" option). Other options are described in [logrotate documentation](https://linux.die.net/man/8/logrotate).

The "postrotate" section tells NATS server to reload the log files once the rotation is complete. The command `` `kill -SIGUSR1 ``cat /var/run/nats-server.pid\`\`\` does not kill the NATS server process, but instead sends it a signal causing it to reload its log files. This will cause new requests to be logged to the refreshed log file.

Expand Down
2 changes: 1 addition & 1 deletion running-a-nats-service/nats_admin/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ See [NATS by Example](https://natsbyexample.com/) under "Authentication and Auth

Golang example from https://natsbyexample.com/examples/auth/nkeys-jwts/go

```
```go
package main

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ In this tutorial you run the [NATS server Docker image](https://hub.docker.com/_

**1. Set up Docker.**

See [Get Started with Docker](http://docs.docker.com/mac/started/) for guidance.
See [Get Started with Docker](https://www.docker.com/get-started/) for guidance.

The easiest way to run Docker is to use the [Docker Toolbox](http://docs.docker.com/mac/step_one/).
The easiest way to run Docker is to use the [Docker Desktop](https://www.docker.com/products/docker-desktop/).

**2. Run the nats-server Docker image.**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ NGS is a global managed NATS network of NATS, and the local containers will conn

Start by creating a free account on [https://cloud.synadia.com/](https://cloud.synadia.com?utm_source=nats_docs&utm_medium=nats).

Once you are logged in, go into the `default` account (you can manage multiple isolated NGS account within your Synadia Cloud account).
Once you are logged in, go into the `default` NGS account (you can manage multiple isolated NGS account within your Synadia Cloud account).

In `Settings` > `Limits`, increase `Leaf Nodes` to 2. Save the configuration change.
(Your free account comes with up to 2 leaf connection, but the account is configured to use at most 1 initially).
Expand Down Expand Up @@ -50,7 +50,7 @@ Launching the container, you should see the NATS server starting successfully:
```

Now start the second leaf nodes with two minor tweaks to the command:
```
```shell
docker run -p 4333:4222 -v leafnode.conf:/leafnode.conf -v /etc/ssl/cert.pem:/etc/ssl/cert.pem -v default-blue.creds:/ngs.creds nats:latest -c /leafnode.conf
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Authenticating with an NKey

The 2.0 version of NATS server introduces a new challenge response authentication option. This challenge response is based on a wrapper we call [NKeys](../../../../running-a-nats-service/configuration/securing_nats/auth_intro/nkey_auth.md). The server can use these keys in several ways for authentication. The simplest is for the server to be configured with a list of known public keys and for the clients to respond to the challenge by signing it with its private key. \(A printable private NKey is referred to as seed\). This challenge-response ensures security by ensuring that the client has the private key, but also protects the private key from the server, which never has access to it!
The 2.0 version of NATS server introduces a new challenge response authentication option. This challenge response is based on a wrapper we call [NKeys](../../../../running-a-nats-service/configuration/securing_nats/auth_intro/nkey_auth.md). The server can use these keys in several ways for authentication. The simplest is, like sshd, for the server to be configured with a list of known public keys and for the clients to respond to the challenge by signing it with its private key. \(A printable private NKey is referred to as seed\). This challenge-response ensures security by ensuring that the client has the private key, but also protects the private key from the server, which never has access to it!

Handling challenge response may require more than just a setting in the connection options, depending on the client library.

Expand Down
4 changes: 2 additions & 2 deletions using-nats/developing-with-nats/connecting/specific_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ For example, to connect to the demo server with a URL you can use:

{% tabs %}
{% tab title="Go" %}
```java
```go
// If connecting to the default port, the URL can be simplified
// to just the hostname/IP.
// That is, the connect below is equivalent to:
Expand All @@ -24,7 +24,7 @@ defer nc.Close()
{% endtab %}

{% tab title="Java" %}
```text
```java
// Connection is AutoCloseable
try (Connection nc = Nats.connect("nats://demo.nats.io:4222")) {
// Do something with the connection
Expand Down
2 changes: 1 addition & 1 deletion using-nats/developing-with-nats/js/publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ foreach (var future in futures)
{% endtab %}

{% tab title="C" %}
```
```c
#include "examples.h"

static const char *usage = ""\
Expand Down
2 changes: 1 addition & 1 deletion using-nats/developing-with-nats/js/streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Common stream management operations are:
* Purge a stream (delete all the messages stored in the stream)
* Get or remove a specific message from a stream by sequence number
* Add or update (or delete) a consumer
* Get info and statistics on streams/consumers/account. Get/remove/get information on individual messages stored in a stream.
* Get info and statistics on streams/consumers/account. Get/remove information on individual messages stored in a stream.

{% tabs %}
{% tab title="Go" %}
Expand Down
23 changes: 11 additions & 12 deletions using-nats/nats-tools/nats_cli/natsbench.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,34 +179,33 @@ NATS Pub/Sub stats: 7,019,849 msgs/sec ~ 107.11 MB/sec
min 1,170,250 | avg 1,170,821 | max 1,171,181 | stddev 349 msgs
```

## Run a request-reply latency test
## Run a Micro-service latency test

In one shell start a nats bench in 'reply mode' and let it run
In one shell start a nats bench in 'serve mode' and let it run

```bash
nats bench foo --sub 1 --reply
nats bench service serve foo --clients=1
```

And in another shell send some requests

```bash
nats bench foo --pub 1 --request --msgs 10000
nats bench service request foo --clients=1 --msgs=10000
```

```
23:47:35 Benchmark in request-reply mode
23:47:35 Starting request-reply benchmark [msgs=10,000, msgsize=128 B, pubs=1, subs=0, js=false, request=true, reply=false]
23:47:35 Starting publisher, publishing 10,000 messages
Finished 1s [==============================================================================================================================================================================================================================================================================================================================================================================================================================================================] 100%
23:29:05 Starting Core NATS service requester benchmark [clients=1, msg-size=128 B, msgs=10,000, sleep=0s, subject=foo]
23:29:05 [1] Starting Core NATS service requester, requesting 10,000 messages
Finished 0s [==================================================================================================================] 100%

Pub stats: 8,601 msgs/sec ~ 1.05 MB/sec
NATS Core NATS service requester stats: 11,016 msgs/sec ~ 1.3 MiB/sec ~ 90.78us
```

In this case the average latency of request-reply between the two `nats bench` processes over NATS was 1/8,601th of a second (116.2655505 microseconds).
In this case the average latency of request-reply between the two `nats bench` processes over NATS was 1/11,016th of a second (90.78 microseconds).

You can now hit control-c to kill that `nats bench --reply` process
You can now hit control-c to kill that `nats bench service serve` process

Note: by default `nats bench` subscribers in 'reply mode' join a queue group, so you can use `nats bench` for example to simulate a bunch of load balanced server processes.
Note: by default `nats bench` subscribers in 'serve mode' join a queue group, so you can use `nats bench` for example to simulate a bunch of load balanced server processes.

## Run JetStream benchmarks

Expand Down
4 changes: 2 additions & 2 deletions using-nats/nats-tools/nsc/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ nsc describe operator
+-----------------------+----------------------------------------------------------+
```

Since the operator JWT is just a JWT you can use other tools, such as jwt.io to decode a JWT and inspect its contents. All JWTs have a header, payload, and signature:
Since the operator JWT is just a JWT you can use other tools, such as https://jwt.io to decode a JWT and inspect its contents. All JWTs have a header, payload, and signature:

```text
{
Expand Down Expand Up @@ -408,7 +408,7 @@ Received on [hello]: ’NATS’

### Create a `nats` context

If you are going to use those credentials with `nats` you should create a context so you don't have to pass the connection and authentication arguments each time:
If you are going to use those credentials with `nats` CLI you should create a context so you don't have to pass the connection and authentication arguments each time:

```shell
nats context add myuser --creds ~/.nkeys/creds/MyOperator/MyAccount/MyUser.creds
Expand Down
Loading