This message was deleted.
# general
s
This message was deleted.
j
Hi! Would you mind sharing the consumers' code with us?
But I'm not surprised of this behavior because, quoting the doc:
When using non-persistent delivery, killing a Pulsar broker or disconnecting a subscriber to a topic means that all in-transit messages are lost on that (non-persistent) topic, meaning that clients may see message loss.
consumer2 was disconnected from the non-persistent topic, so it sees message loss.
Could you please explain to us what you are trying to achieve? Why not use a persistent topic?
d
Copy code
from pulsar import Client, ConsumerType, MessageId

service_url = '<pulsar://xxxxxxxx:6650>'
topic = '<non-persistent://test/memtest/test-03>'

client = Client(service_url)
consumer = client.subscribe(topic, subscription_name='my-subscription-02')
consumer.seek(MessageId.earliest)

while True:
    msg = consumer.receive()
    message = msg.data().decode('utf-8')
    consumer.acknowledge(msg)
    #time.sleep(5)
    block = message.split(',')[0]
    print(block)
The reason I’m using it is that with the
sync
method, non-persistent topics are significantly faster. Persistent topics take 2ms per message, while non-persistent topics only take 0.2ms. So, we plan to use an asynchronous consumer to write the data to the database instead of using persistent topics.
I found the reason. I changed the setting ‘receiverQueueSize()’, and it resulted in data loss after the sleep. This behavior is as expected.
👍 1