apache-pulsar – How to Delete All Messages from an Apache Pulsar Topic

message-queuing

Is there a way to use the Pulsar command line tools to delete all messages for a topic? It doesn't have any subscriptions yet and from what I can tell the tools that do this operate on a subscription. I need to get rid of the old junk before starting the service that consumes the topic.

Best Answer

@David Tinker, Please try this delete topic command: $ pulsar-admin persistent delete persistent://test-tenant/ns1/tp1 Before execute, there should be not any active subscription or producer connected to it. If topic has subscription and producers connected, and you done care the existing data, you could add --force at the end. After delete this topic, when produce data, producer will reconnect and auto create the topic with same name.

Related Topic