Last active
November 9, 2019 19:44
-
-
Save cdbartholomew/51e6b8729fbd21f4269ff6fdddac93c5 to your computer and use it in GitHub Desktop.
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,time,_pulsar | |
service_url = 'pulsar+ssl://uscentral1.azure.kafkaesque.io:6651' | |
trust_certs='/etc/ssl/certs/ca-bundle.crt' | |
token='***************************************************************************************************' | |
client = pulsar.Client(service_url, | |
authentication=pulsar.AuthenticationToken(token), | |
tls_trust_certs_file_path=trust_certs) | |
consumer = client.subscribe('persistent://azure-kafkaesque-io/local-uscentral1-azure/subscription-demo', | |
'exclusive', | |
consumer_type=_pulsar.ConsumerType.Exclusive) | |
while True: | |
try: | |
msg = consumer.receive(2000) | |
print("Received message '{}' id='{}'".format(msg.data(), msg.message_id())) | |
consumer.acknowledge(msg) | |
except: | |
pass | |
time.sleep(1) | |
client.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment