<@U078Y59KC3B> Do pulsar support pause Topic, that...
# ask-ai
e
@RunLLM Do pulsar support pause Topic, that stop consume msg but publish still allowed
r
Yes, Apache Pulsar supports pausing a consumer on a specific topic, which stops the consumer from receiving messages while still allowing publishing to continue. This can be done using the
pause
method on the consumer. For example, in Java, you can pause a consumer using the
pause
method:
Copy code
ConsumerString consumer = pulsarClient.newConsumer(Schema.STRING)
    .topic("myTopic")
    .subscriptionName("mySub")
    .subscribe();

consumer.pause();
However, it's important to note that pausing a consumer does not immediately stop the receipt of messages if there are already available permits. The consumer will continue to receive messages until the available permits are exhausted, as discussed in this GitHub issue. Would you like more detail on this topic? Sources: - GitHub Issue: consumer.pause is not working as expected - GitHub Pull Request: improve java-client check consumer pause status before consumer receive/batchReceive 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.