Skip to content

Latest commit

 

History

History
75 lines (59 loc) · 2 KB

README.md

File metadata and controls

75 lines (59 loc) · 2 KB

tzpipe utility for minibus message handling from the shell

tzpipe is a command line utility that lets you send and receive messages to and from a minibus service.

USAGE

tzpipe [send|listen] channel arg1 arg2..

Listening:

tzpipe always needs a verb (send | listen) and a minibus channel name to operate on, with no other parameters this listens on the selected channel and outputs to STDOUT.

Here we connect to a ficticious channel that is being sent random animals:

> tzpipe listen animals
cats
dogs
rabbits
...

We can give tzpipe a regular expression (using Golang's regex syntax)

> tzpipe listen animals --filter='^dogs'
dogs
dogs
dogs 
...

While this is interesting, sometimes you may want to wait for a particular message and then act on it in a script, you can do this by using the --limit argument which will exit tzpipe after a given number of messages:

l=$(tzpipe listen animals --filter='llama' --limit=1)
echo "Found a $l!"

Sending

tzpipe allows you to send messages to channels as well, there are a number of ways to do this:

> tzpipe send foo 'This is a message'

tzpipe accepts STDIN and will send each line to the channel, you can use --limit here as well to stop capturing after a number of lines:

cat /dev/poetry | tzpipe send foo --limit=100

You can use tzpipe to reduce incomming messages and deliver them to a different channel, here we filter cats from the animals channel, log matches to STDERR and send them on to the 'catsonly' channel:

tzpipe listen animals --filter='^cats' --log | tzpipe send catsonly



ttyZero Logo

tzpipe is part of the ttyZero Project

tzpipe is (c) 2018 ttyZero authors
and is available under the MIT license.