# 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>


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.

## Examples

Note

The examples use the db1 profile. To learn more, see Creating a connection profile.

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 db1 topic consumer add \
--consumer my-consumer \
--starting-message-timestamp 1660568400 \
my-topic


Make sure the consumer was created:

ydb -p db1 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         |
└──────────────┴─────────────────┴───────────────────────────────┴───────────┘