Created
February 25, 2019 13:31
-
-
Save skyrocknroll/d33c4a9a827d3a6afa2d08608dc0aa1e to your computer and use it in GitHub Desktop.
[apache pulsar] #python #client #seek #begining
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pulsar | |
from pulsar import MessageId | |
client = pulsar.Client('pulsar://pulsar.stage.x.com:6650',) | |
consumer = client.subscribe('persistent://public/default/my-topic-3', 'test-sub5',) | |
consumer.seek(pulsar.MessageId.earliest) | |
#consumer.seek(pulsar.MessageId.latest) | |
while True: | |
msg = consumer.receive() | |
print("Received message '{}' id='{}'".format(msg.data(), msg.message_id())) | |
consumer.acknowledge(msg) | |
client.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment