Last active
May 25, 2019 23:31
-
-
Save Jammink2/d9599f0c20586b5d0bfbb23f6bc2e622 to your computer and use it in GitHub Desktop.
Revisions
-
Jammink2 revised this gist
May 25, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ # be sure to copy your ca.pem, service.cert and service.key to local directory from your Aiven Kafka instance. consumer = KafkaConsumer( "demo-topic", bootstrap_servers="<URI_to_Aiven_Kafka>.aivencloud.com:27974", client_id="demo-client-1", group_id="demo-group", -
Jammink2 created this gist
May 3, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ # iBeacon Consumer simulator for Aiven Kafka # This script receives messages from a Kafka topic # usage: python ibeacon_consumer.py # [email protected] from kafka import KafkaConsumer from time import sleep # method that receives the message # be sure to copy your ca.pem, service.cert and service.key to local directory from your Aiven Kafka instance. consumer = KafkaConsumer( "sample-topic", bootstrap_servers="<URI_to_Aiven_Kafka>.aivencloud.com:27974", client_id="demo-client-1", group_id="demo-group", security_protocol="SSL", ssl_cafile="ca.pem", ssl_certfile="service.cert", ssl_keyfile="service.key", ) while True: raw_msgs = consumer.poll(timeout_ms=100000) for tp, msgs in raw_msgs.items(): for msg in msgs: print("Received: {}".format(msg.value)) # sleep added to show messages coming in as they are consumed sleep(3)