Slackbot
09/11/2023, 8:55 AMJulien Jakubowski
09/11/2023, 1:32 PMJulien Jakubowski
09/11/2023, 1:40 PMWhen 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.
Julien Jakubowski
09/11/2023, 1:43 PMduke
09/11/2023, 2:04 PMfrom 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)duke
09/11/2023, 2:04 PMsync 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.duke
09/12/2023, 10:39 AM