Categorygithub.com/sourabp/nats-streaming-cli
modulepackage
0.0.0-20200822185343-9688f4276934
Repository: https://github.com/sourabp/nats-streaming-cli.git
Documentation: pkg.go.dev

# README

nats-streaming-cli

CLI for Nats streaming service.

The CLI can be used to publish messages and subscribe to messages from a nats streaming service cluster.

Get Started: Install the CLI

You can install the CLI via go modules or pull a docker image.

GO Module

go install github.com/sourabp/nats-streaming-cli

Docker pull

docker pull sourabp/nats-streaming-cli

Run the CLI

The main commands supported by the CLI are:

  • publish: publishes message to a channel
  • subscribe: subscribe to messages from a channel, terminates on SIGKILL or SIGTERM

Conection parameters

Default url of nats-streaming-service: localhost:4222 and cluster id: test-cluster

Publish

$ nats-streaming-cli publish -q "foo_channel" "Hello World"

// Publishing to non-default cluster
$ nats-streaming-cli publish -s "<nats_server_ip>" -p "<nats_server_port>" -c "prod_cluster" -q "foo_channel" "Hello World"

Subscribe

$ nats-streaming-cli subscribe -q "foo_channel"

// Add multiple subscribers to listen to a single queue group
$ nats-streaming-cli subscribe -q "foo_channel" --queue-group "baz_group" // consumer 1
$ nats-streaming-cli subscribe -q "foo_channel" --queue-group "baz_group" // consumer 2

# Packages

Copyright © 2020 NAME HERE <EMAIL ADDRESS> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.