Managing Topics
On this section you will learn how to create, list, delete topics within your Kafka cluster
Last updated
On this section you will learn how to create, list, delete topics within your Kafka cluster
Last updated
A topic is described as a Stream of messages of a particular type. For example:
Debit Transactions
Credit Transactions
Topics are broken down one level more of granularity, they are formed by partitions.
Messages are written to it in an append-only fashion, and are read in order from beginning to end. There are no guarantee of ordering in a topic, but there is guarantee of ordering on the partition
From you bin folder, there is an script called kafka-topics.sh or kafka-topics.bat
, and it will facilitate for you the creation of a Topic in your cluster
Go ahead and explore the options available for working with Topics via CLI
Now that you have explored a bit the command line, go ahead and create a topic with the following conditions:
Topic name: wwcode
Number of Partitions: 2
Replicas: 1
Try to create the same topic only if it doesn't exist.
When working with Kafka, you are most likely curious to see what is going on with your topic, if It was already created/updated/deleted, if the replicas are in sync or what is the partition leader.
Go ahead and list your topics by executing:
Try to gather a full detailed description of the topic, specifically retrieve, PartitionCount, ReplicationFactor, and ISR ( In Sync Replicas)
There might be cases when you would like to delete a Topic. For example, there is type of event that will be retired from your application and you would like to delete this topic to avoid writing to a topic that won't be used anymore.
Go ahead and try to delete the topic you just have created before.
Try to delete a topic that does not exist and see what happens. How you could solve this issue?