Skip to content

Instantly share code, notes, and snippets.

@cdbartholomew
Last active November 9, 2019 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdbartholomew/51e6b8729fbd21f4269ff6fdddac93c5 to your computer and use it in GitHub Desktop.
Save cdbartholomew/51e6b8729fbd21f4269ff6fdddac93c5 to your computer and use it in GitHub Desktop.
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