Skip to content

Commit

Permalink
fix: more examples for consume produce (#1609)
Browse files Browse the repository at this point in the history
  • Loading branch information
wtrocki authored Jun 27, 2022
1 parent 62ad5e4 commit 7ed4cfa
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
6 changes: 0 additions & 6 deletions docs/commands/rhoas_kafka_topic.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 16 additions & 7 deletions pkg/core/localize/locales/en/cmd/kafka.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -606,14 +606,14 @@ $ rhoas kafka topic consume --name=topic-1
# Consume from topic and output yaml format
$ rhoas kafka topic consume --name=topic-1 --format=yaml
# Consume from a topic and wait for messages produced since command was ran
# Consume from a topic continously by pooling for new messages
$ rhoas kafka topic consume --name=topic-1 --wait
# Consume from a topic starting from a certain time using the default ISO time format
$ rhoas kafka topic consume --name=topic-1 --wait --from=2022-06-17T07:05:34+00:00Z
$ rhoas kafka topic consume --name=topic-1 --from=2022-06-17T07:05:34+00:00Z
# Consume from a topic starting from a certain time using unix time format
$ rhoas kafka topic consume --name=topic-1 --wait --unix-time --from=812762
$ rhoas kafka topic consume --name=topic-1 --wait --unix-time --from=1656346796
# Consume from a topic starting from an offset
$ rhoas kafka topic consume --name=topic-1 --offset=15
Expand Down Expand Up @@ -781,14 +781,23 @@ Produce a message to a topic in a Kafka instance. Pass a file path to read that

[kafka.topic.produce.cmd.example]
one = '''
# Produce to a topic with the value being read from a file
$ rhoas kafka topic produce --name=topic-1 --file="./value.json" --key=my-value
# Produce single message read from a file and provide custom message key
$ rhoas kafka topic produce --name=users --file="./message.json" --key="{'location': 'us-east-1'}"
# Produce to a topic and be prompted to enter a value
$ rhoas kafka topic produce --name=topic-1
# Produce to a topic from standard input (requires terminating command with Ctrl+D)
$ rhoas kafka topic produce --name=users
# Produce to a topic from other command output
$ cat yourfile.json | rhoas kafka topic produce --name=users
# Produce to a topic and fetch its offset
$ rhoas kafka topic produce --name=topic-1 --file="./message.json" | jq .offset
# Produce to a topic with json filtered with jq as the value
$ cat input.json | jq .data.value | rhoas kafka topic produce --name=topic-1
# Produce to a topic with specific partition
$ rhoas kafka topic produce --name=topic-1 --file="./message.json" --partition=1
'''

[kafka.topic.create.error.topicNameIsRequired]
Expand Down
6 changes: 0 additions & 6 deletions pkg/core/localize/locales/en/cmd/topic.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,4 @@ rhoas kafka topic create --name mytopic
# List all topics
rhoas kafka topic list
# Produce message from file to topic
rhoas kafka topic produce --name mytopic --file message.json
# Consume 10 most recent messages from topic
rhoas kafka topic consume --name mytopic --limit 10
'''

0 comments on commit 7ed4cfa

Please sign in to comment.