pubsub-client/README.md

78 lines
1.6 KiB
Markdown

# PubSub client
## Quick and easy
1. run `sudo docker build -t client .`
2. run `sudo docker run --rm --network=host -it client publish topic message`
2. run `sudo docker run --rm --network=host -it client consume topic`
## With Cargo
1. run `cargo build --release`
2. run `./target/release/client publish topic message`
2. run `./target/release/client consume topic`
## CLI
Note that there are a few changes in the CLI interface as opposed to what's in
the email. Please see `--help` for details.
Examples (binary named client):
Publish a message
`client publish mytopic mymessage`
Consume a message (default timeout of 10s)
`client consume mytopic`
Consume a message with given timeout (seconds)
`client consume mytopic -t 15`
```
$ ./target/release/client --help
pubsub-rs 0.1.0
USAGE:
client [OPTIONS] <SUBCOMMAND>
OPTIONS:
-e, --endpoint <ENDPOINT> [default: localhost]
-h, --help Print help information
-p, --port <PORT> [default: 50051]
--protocol <PROTOCOL> [default: tcp] [possible values: http, tcp]
-V, --version Print version information
SUBCOMMANDS:
consume
help Print this message or the help of the given subcommand(s)
publish
```
Publish:
```
client-publish
USAGE:
client publish <TOPIC> <MESSAGE>
ARGS:
<TOPIC>
<MESSAGE>
OPTIONS:
-h, --help Print help information
```
Consume:
```
client-consume
USAGE:
client consume [OPTIONS] <TOPIC>
ARGS:
<TOPIC>
OPTIONS:
-h, --help Print help information
-t, --timeout <TIMEOUT> [default: 10]
```