mirror of
https://github.com/taigrr/nats.docs
synced 2025-01-18 04:03:23 -08:00
Update streams.md
This commit is contained in:
parent
a176d807ab
commit
109a8a59c3
@ -52,10 +52,10 @@ Messages this account publishes on `a.b.c.>` will be forwarded to all accounts t
|
|||||||
|
|
||||||
Importing a stream enables you to receive messages that are published by a different _Account_. To import a Stream, you have to create an _Import_. To create an _Import_ you need to know:
|
Importing a stream enables you to receive messages that are published by a different _Account_. To import a Stream, you have to create an _Import_. To create an _Import_ you need to know:
|
||||||
|
|
||||||
* The exporting account’s public key
|
- The exporting account’s public key
|
||||||
* The subject where the stream is published
|
- The subject where the stream is published
|
||||||
* You can map the stream’s subject to a different subject
|
- You can map the stream’s subject to a different subject
|
||||||
* Self-imports are not valid; you can only import streams from other accounts.
|
- Self-imports are not valid; you can only import streams from other accounts.
|
||||||
|
|
||||||
To learn how to inspect a JWT from an account server, [check this article](../nas/inspecting_jwts.md).
|
To learn how to inspect a JWT from an account server, [check this article](../nas/inspecting_jwts.md).
|
||||||
|
|
||||||
@ -147,12 +147,12 @@ Like before we defined an export, but this time we added the `--private` flag.
|
|||||||
╰──────┴────────┴─────────┴────────╯
|
╰──────┴────────┴─────────┴────────╯
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Generating an Activation Token
|
### Generating an Activation Token
|
||||||
|
|
||||||
For a foreign account to _import_ a private stream, you have to generate an activation token. The activation token in addition to granting permissions to the account, it also allows you to subset the exported stream’s subject.
|
For a foreign account to _import_ a private stream, you have to generate an activation token. The activation token in addition to granting permissions to the account, it also allows you to subset the exported stream’s subject.
|
||||||
|
|
||||||
Let’s create an account and user for our stream client:
|
Let’s create an account and user for our stream client:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
> nsc add account --name AccountB
|
> nsc add account --name AccountB
|
||||||
Generated account key - private key stored “~/.nkeys/Test/accounts/AccountB/AccountB"
|
Generated account key - private key stored “~/.nkeys/Test/accounts/AccountB/AccountB"
|
||||||
@ -252,26 +252,22 @@ nsc describe account
|
|||||||
### Testing the Private Stream
|
### Testing the Private Stream
|
||||||
|
|
||||||
Start the `nats-account-server`:
|
Start the `nats-account-server`:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
> nats-account-server -nsc ~/.nsc/nats/Test
|
> nats-account-server -nsc ~/.nsc/nats/Test
|
||||||
```
|
```
|
||||||
|
|
||||||
Create a config for the nats server `server.conf`:
|
Create a config for the nats server `server.conf`:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
operator: /Users/synadia/.nsc/nats/Test/Test.jwt
|
operator: /Users/synadia/.nsc/nats/Test/Test.jwt
|
||||||
resolver: URL(http://localhost:9090/jwt/v1/accounts/)
|
resolver: URL(http://localhost:9090/jwt/v1/accounts/)
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the `nats-server`:
|
Start the `nats-server`:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
> nats-server -c server.conf
|
> nats-server -c server.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the subscriber for the client account:
|
Start the subscriber for the client account:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
> nats-sub -creds ~/.nkeys/Test/accounts/AccountB/users/userb.creds ">"
|
> nats-sub -creds ~/.nkeys/Test/accounts/AccountB/users/userb.creds ">"
|
||||||
Listening on [>]
|
Listening on [>]
|
||||||
@ -292,6 +288,7 @@ Published [a.b.c.d] : 'hello'
|
|||||||
The subscriber as expected prints a message on the stream that it was allowed to receive:
|
The subscriber as expected prints a message on the stream that it was allowed to receive:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
|
[#1] Received on [a.b.c.d.a.b.c.d]: 'hello'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user