Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olivere/nats-streaming-server-example
An example of using a local NATS Streaming Server cluster for pub/sub.
https://github.com/olivere/nats-streaming-server-example
golang-examples nats nats-streaming-server pubsub
Last synced: 7 days ago
JSON representation
An example of using a local NATS Streaming Server cluster for pub/sub.
- Host: GitHub
- URL: https://github.com/olivere/nats-streaming-server-example
- Owner: olivere
- License: mit
- Created: 2019-07-05T15:22:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-07-05T15:27:13.000Z (over 5 years ago)
- Last Synced: 2024-11-19T05:28:45.635Z (2 months ago)
- Topics: golang-examples, nats, nats-streaming-server, pubsub
- Language: Go
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NATS Streaming Server example
This example illustrates how to run a local cluster of
NATS streaming servers doing some pub/sub.## Prerequisites
The example has been tested with NATS streaming server 0.15.1
and Go 1.11.6.## Nutshell
Open 1st console:
```
$ nats-streaming-server -c a.conf
...
```Open 2nd console:
```
$ nats-streaming-server -c b.conf
...
```Open 3rd console:
```
$ nats-streaming-server -c c.conf
...
```Open 4th console to compile and run a producer of messages
being sent to the cluster:```
$ make
$ ./pub
...
```Open 5th console to run a first consumer of messages:
```
$ ./sub
...
```Open 6th console to run a second consumer of messages:
```
$ ./sub
...
```As the consumers work as a consumer group, only one of the
consumers gets a message. This is in contrast to a normal
subscription model where each consumer gets a copy of each
message.# Licenses
MIT