-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #788 from jehiah/to_nsq_rate_788
apps/to_nsq: add --rate to throttle message creation
- Loading branch information
Showing
2 changed files
with
52 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
# to_nsq | ||
|
||
A tool for publishing to an nsq topic data from `stdin`. | ||
A tool for publishing to an nsq topic with data from `stdin`. | ||
|
||
## Usage | ||
|
||
Publish each line of a file: | ||
|
||
``` | ||
cat source.txt | to_nsq -topic="topic" -nsqd-tcp-address="127.0.0.1:4150" | ||
Usage of ./to_nsq: | ||
-delimiter string | ||
character to split input from stdin (default "\n") | ||
-nsqd-tcp-address value | ||
destination nsqd TCP address (may be given multiple times) | ||
-producer-opt value | ||
option to passthrough to nsq.Producer (may be given multiple times, http://godoc.org/github.com/nsqio/go-nsq#Config) | ||
-rate int | ||
Throttle messages to n/second. 0 to disable | ||
-topic string | ||
NSQ topic to publish to | ||
``` | ||
|
||
### Examples | ||
|
||
Publish manually entered lines in a shell: | ||
|
||
``` | ||
to_nsq -topic="topic" -nsqd-tcp-address="127.0.0.1:4150" | ||
one | ||
two | ||
three | ||
(Ctrl+C to stop) | ||
``` | ||
|
||
Publish comma separated values from a source file: | ||
Publish each line of a file: | ||
|
||
``` | ||
cat source.txt | to_nsq -delimiter="," -topic="topic" -nsqd-tcp-address="127.0.0.1:4150" | ||
```bash | ||
$ cat source.txt | to_nsq -topic="topic" -nsqd-tcp-address="127.0.0.1:4150" | ||
``` | ||
|
||
Publish three messages, in one go: | ||
|
||
``` | ||
echo "one,two,three" | to_nsq -delimiter="," -topic="topic" -nsqd-tcp-address="127.0.0.1:4150" | ||
```bash | ||
$ echo "one,two,three" | to_nsq -delimiter="," -topic="topic" -nsqd-tcp-address="127.0.0.1:4150" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters