Kafka in Python with Gramine-SGX #1709
dimakuv
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I recently tried Apache Kafka with Kafka Python (
confluent-kafka
Python package).Latest Gramine (v1.6) works without any problems, at least on the example Kafka Producer and Kafka Consumer Python scripts that I was given.
Here I'll describe how to adapt our existing Python CI example to Kafka Python. Unfortunately I was given a private Kafka instance, with closed-source Python scripts. So I anonymize these parts.
Preparation
I tried on Ubuntu 20.04, with Gramine v1.6. First, install Kafka:
# sudo needed to install into system-wide Python dirs where Gramine Python example looks for files $ sudo pip3 install confluent-kafka
For Kafka Python example, I copy-pasted the existing Gramine Python example into a new dir:
There are the new files I added:
The
kafka-consumer.py
script basically does this:The
kafka-producer.py
script basically does this:Gramine manifest
The manifest is modified like this:
NOTE: Many parts of the original Python manifest can be removed, as they are not required by Kafka. Left as an exercise for readers.
Running
I ran my example scripts like this:
Beta Was this translation helpful? Give feedback.
All reactions