Skip to content

Instantly share code, notes, and snippets.

@merlin-quix
Last active January 23, 2023 07:20
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 merlin-quix/6850c4519902b76da23bb9f4047b5ba3 to your computer and use it in GitHub Desktop.
Save merlin-quix/6850c4519902b76da23bb9f4047b5ba3 to your computer and use it in GitHub Desktop.
Step 1 in the procedure "Creating a Kafka Producer to send data" from this article: https://www.quix.io/blog/send-timeseries-data-to-kafka-python/
# Import packages
import pandas as pd
import json
import datetime as dt
from time import sleep
from kafka import KafkaProducer
# Initialize Kafka Producer Client
producer = KafkaProducer(bootstrap_servers=['localhost:9092'])
print(f'Initialized Kafka producer at {dt.datetime.utcnow()}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment