feat: add readme
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
fc27206708
commit
5f048f7a76
40
README.md
Normal file
40
README.md
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Real time streaming example
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
First you will need the nats cli, it is only required if you actually want to send some events
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go install github.com/nats-io/natscli/nats@latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Now to spin up the resources:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
Now to sign in with nats
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nats context add real-time
|
||||||
|
# This creates a file in ~/.config/nats/real-time.json
|
||||||
|
# Edit that and set username and password to `natsadmin`
|
||||||
|
nats ctx select real-time
|
||||||
|
```
|
||||||
|
|
||||||
|
And subscribe with nats
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nats sub cli.demo
|
||||||
|
```
|
||||||
|
|
||||||
|
In a new terminal publish events
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nats pub cli.demo '{"key":"value"}' --count=0 # count 0 will send a lot of events
|
||||||
|
```
|
||||||
|
|
||||||
|
Now open your client of choice: I used datagrip with default settings, simply add port 8123 and localhost and you should be good.
|
||||||
|
|
||||||
|
The table will be in default called daily. It will contain a column key, with a bunch of rows with the value: `value`
|
Loading…
Reference in New Issue
Block a user