giannimassi / natsy

Simple NATS client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Natsy

Simple NATS client that allows to publish and make requests

Usage

Natsy supports both command line flags and configuration file (flags override file configuration).

Flags
            --message string     nats message
            --request            nats request
            --subject string     nats subject
            --timeout duration   nats timeout (request only) (default 1s)
            --url string         nats url
E.g
./natsy --url "demo.nats.io" --subject "foo"  --message "Hello, world." --timeout 500ms
demo.nats.io - foo > Hello, world.
demo.nats.io - foo < published
Request

natsy can be used to make request also if the --request flag is provided:

./natsy --url "demo.nats.io" --subject "foo"  --message "Hello, world." --request

Example output:

demo.nats.io - foo > Hello, world.
demo.nats.io - foo < demo.nats.io - foo < err: nats: timeout
Configuration file

Natsy looks for a configuration file called config.yaml in the same directory it is executed.

E.g

config.yaml

url: demo.nats.io
subject: foo
message: "Hello, world."
timeout: 500ms
request: false
E.g
./natsy
demo.nats.io - foo > Hello, world.
demo.nats.io - foo < published

About

Simple NATS client


Languages

Language:Go 100.0%