-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Testing the `nats` source
Stephen Wakely edited this page Nov 28, 2022
·
1 revision
First run up a Nats server - accessible via port 4444:
> docker run -p 4444:4444 nats -p 4444
Unable to find image 'nats:latest' locally
latest: Pulling from library/nats
d928bc8a30b5: Pull complete
870fcc9cb7dd: Pull complete
Digest: sha256:9b2c3b928d27250178e846061a0523ce812a5f6658bfe0d8f6e3ad6f388d03bc
Status: Downloaded newer image for nats:latest
[1] 2022/11/28 12:11:35.643713 [INF] Starting nats-server
[1] 2022/11/28 12:11:35.643743 [INF] Version: 2.9.8
[1] 2022/11/28 12:11:35.643744 [INF] Git: [60e335a]
[1] 2022/11/28 12:11:35.643747 [INF] Name: NDBOPX5WOGU6KQPX5X6GPI6V6RFSIDNRJFULPPKGHJDPFN3VEAQPIIZV
[1] 2022/11/28 12:11:35.643749 [INF] ID: NDBOPX5WOGU6KQPX5X6GPI6V6RFSIDNRJFULPPKGHJDPFN3VEAQPIIZV
[1] 2022/11/28 12:11:35.644010 [INF] Listening for client connections on 0.0.0.0:4444
[1] 2022/11/28 12:11:35.644093 [INF] Server is ready
Configure Vector with a nats source connecting to port 4444, listening to subject nork
:
sources:
nats:
type: nats
url: "nats://127.0.0.1:4444"
subject: nork
connection_name: zork
Download the nats
client tool from here.
Send messages over nats
to subject nork
with a command similar to:
> ./nats publish nork --count 10 "Zork {{Count}}: {{ Random 10 100 }}" --server 127.0.0.1:4444
12:20:44 Published 26 bytes to "nork"
12:20:44 Published 97 bytes to "nork"
12:20:44 Published 78 bytes to "nork"
12:20:44 Published 55 bytes to "nork"
12:20:44 Published 102 bytes to "nork"
12:20:44 Published 25 bytes to "nork"
12:20:44 Published 36 bytes to "nork"
12:20:44 Published 33 bytes to "nork"
12:20:44 Published 22 bytes to "nork"
12:20:44 Published 55 bytes to "nork"