Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anjmao/cnats
NATS / NATS streaming command line utility
https://github.com/anjmao/cnats
cmd golang nats nats-streaming
Last synced: 12 days ago
JSON representation
NATS / NATS streaming command line utility
- Host: GitHub
- URL: https://github.com/anjmao/cnats
- Owner: anjmao
- License: mit
- Created: 2019-05-31T11:00:19.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-07T00:48:30.000Z (over 1 year ago)
- Last Synced: 2024-06-20T15:53:22.017Z (5 months ago)
- Topics: cmd, golang, nats, nats-streaming
- Language: Go
- Homepage:
- Size: 32.2 KB
- Stars: 10
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cnats
NATS / NATS streaming command line utility for publishing and subscribing to messages.### Installation
#### Go users
```
go get -u github.com/anjmao/cnats
```#### Other users
Download release binary from https://github.com/anjmao/cnat/releases and add to PATH.
### Usage
#### Initialize cnat with configuration file which is written to HOME/.cnat/config.json
Initialize with cluser, client and url.
```
cnats init -cluster test-cluster -client cnat-client -url nats://localhost:4222
```Initialize with default values.
```
cnats init
```#### Subscribe to subjects
Subscribe to nats streaming subjects.
```
cnats ssub topic1 topic2
```Subscribe to all known subjects. Internally sub command calls stan monitoring api to get all known subjects.
```
cnats ssub
```Subscribe at given time.
```
cnats ssub topic1 -at_time="2020-08-20T11:20:22.9832464Z"
```Subscribe at given sequence.
```
cnats ssub topic1 -at_seq=0
```Subscribe to nats subjects.
```
cnats sub topic1 topic2
```#### Publish to subject
Publish to nats streaming.
```
cnats spub topic1 '{"name": "cnat"}'
```Publish to nats.
```
cnats pub topic1 '{"name": "cnat"}'
```### Release
Before running `make release` make sure you have these tools installed.
```
GO111MODULE=off go get github.com/c4milo/github-release
GO111MODULE=off go get github.com/mitchellh/gox
```