The CLI can view, create and modify topics. The commands for these actions are shown in the table below.
create
delete
update
The optional names flag wil display only the names of the topics. If you use the –unwrap flag, each topic name will be displayed on a new line as text:
# list all topics lenses-cli topics # list only the metadata lenses-cli topics metadata # list only the keys lenses-cli topics keys
lenses-cli topic --name=cc_payments
lenses-cli topic create \ --name="topicName" \ --replication=1 \ --partitions=1 \ --configs="{\"max.message.bytes\": \"1000010\"}"
Update from a file:
lenses-cli topic create ./topic.yml
Example file:
name: topicName replication: 1 partitions: 1 configs: max.message.bytes: "1000010"
lenses-cli topic update \ --name="topicName" \ --configs="{\"max.message.bytes\": \"1000020\"}"
lenses-cli topic update ./topic.yaml
name: topicName configs: max.message.bytes: "2000010"
# first change the key/value type lenses-cli topics metadata set \ --name=topicName \ --key-type=json \ --value-type=json # now you may change its schema lenses-cli topics metadata set \ --name=topicName \ --key-type=json \ --key-schema="{\"type\":\"record\",\"name\":\"lenses_record\",\"namespace\":\"lenses\",\"fields\":[{\"name\":\"keyField\",\"type\":\"string\"}]}" \ --value-type=json \ --value-schema="{\"type\":\"record\",\"name\":\"lenses_record\",\"namespace\":\"lenses\",\"fields\":[{\"name\":\"valueField\",\"type\":\"string\"}]}"
name: topicName keyType: bytes valueType: xml valueSchema: "{\"type\":\"record\",\"name\":\"lenses_record\",\"namespace\":\"lenses\",\"fields\":[{\"name\":\"heading3\",\"type\":\"string\"}]}"
lenses-cli topic delete --name="topicName"
On this page