Giter VIP home page Giter VIP logo

natscat's Introduction

natscat

NATS command line utility

usage

$ natscat
natscat [messages...]

Options:
  --version          Show version number                               [boolean]
  ----nats, -n       nats url
  ----subject, -j    subjects
  ----subscribe, -s  subscribe                                         [boolean]
  ----publish, -p    publish                                           [boolean]
  ----request, -r    request                                           [boolean]
  ----file, -f       input json or yaml file
  --help             Show help                                         [boolean]

example

subscribe to subject

# subscribe
$ natscat -sc test.subject
2019-04-26 10:10:11.524      subscribed to test.subject
2019-04-26 10:10:33.095 <=== hello natscat  test.subject 

publish message to subject

# publish
$ natscat -pc test.subject "hello natscat"
2019-04-26 10:10:33.098 ===> hello natscat  test.subject

subscribe and reply

# subscribe & reply
$ natscat -sc test.subject "you too"
2019-04-26 10:13:18.921      subscribed to test.subject
2019-04-26 10:13:25.564 <=== hello natscat  test.subject 
2019-04-26 10:13:25.568 ===> you too  _INBOX.IN62QEIRU5TYT3Q0UEERN5.IN62QEIRU5TYT3Q0UEERR7 

request

# request
$ natscat -rc test.subject "hello natscat"
2019-04-26 10:13:24.896 ===> hello natscat  test.subject 
2019-04-26 10:13:25.569 <=== you too  test.subject

send multiple message to multiple subject

$ natscat -p -j test.subject1 -j test.subject2 message1 message2
2019-04-26 10:21:28.977 ===> message1  test.subject1
2019-04-26 10:21:29.655 ===> message1  test.subject2
2019-04-26 10:21:29.656 ===> message2  test.subject1
2019-04-26 10:21:29.658 ===> message2  test.subject2

send json messages from yaml/json file

$ cat > messages.yaml <<EOF
first: message
---
{"second": "message"}
EOF

$ natscat -pj test.subject -f message.yaml
2019-04-26 10:24:08.861 ===> {"first":"message"}  test.subject
2019-04-26 10:24:09.526 ===> {"second":"message"}  test.subject

specify nats server

$ export NATS=127.0.0.1:4222
$ natscat -pj test.subject hello
2019-04-26 10:34:08.515      connecting to nats 127.0.0.1:4222
2019-04-26 10:34:09.194 ===> hello  test.subject

$ natscat -n nats:4222 -pj test.subject hello
2019-04-26 10:35:08.893      connecting to nats nats:4222
2019-04-26 10:35:09.558 ===> hello  test.subject

natscat's People

Contributors

dirty49374 avatar

Stargazers

Júlio Selva avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.