Adding a topic consumer
You can use the topic consumer add
command to add a consumer for a previously created topic.
General format of the command:
ydb [global options...] topic consumer add [options...] <topic-path>
global options
: Global parameters.options
: Parameters of the subcommand.topic-path
: Topic path.
View the description of the add consumer command:
ydb topic consumer add --help
Parameters of the subcommand
Name | Description |
---|---|
--consumer VAL |
Name of the consumer to be added. |
--starting-message-timestamp VAL |
Time in UNIX timestamp format. Consumption starts as soon as the first message is received after the specified time. If the time is not specified, consumption will start from the oldest message in the topic. |
--supported-codecs |
Supported data compression methods. The default value is raw .Possible values: |
Examples
Note
The examples use the quickstart
profile. To learn more, see Creating a profile to connect to a test database.
Create a consumer with the my-consumer
name for the previously created my-topic
topic. Consumption will start as soon as the first message is received after August 15, 2022 13:00:00 GMT:
ydb -p quickstart topic consumer add \
--consumer my-consumer \
--starting-message-timestamp 1660568400 \
my-topic
Make sure the consumer was created:
ydb -p quickstart scheme describe my-topic
Result:
RetentionPeriod: 2 hours
PartitionsCount: 2
SupportedCodecs: RAW, GZIP
Consumers:
┌──────────────┬─────────────────┬───────────────────────────────┬───────────┐
| ConsumerName | SupportedCodecs | ReadFrom | Important |
├──────────────┼─────────────────┼───────────────────────────────┼───────────┤
| my-consumer | RAW, GZIP | Mon, 15 Aug 2022 16:00:00 MSK | 0 |
└──────────────┴─────────────────┴───────────────────────────────┴───────────┘