Skip to content

Instantly share code, notes, and snippets.

@merlin-quix
Last active January 22, 2023 13:35
Show Gist options
  • Save merlin-quix/6946c5d8bb104c29df184dfbcc6d20c1 to your computer and use it in GitHub Desktop.
Save merlin-quix/6946c5d8bb104c29df184dfbcc6d20c1 to your computer and use it in GitHub Desktop.
for i in df.index:
# Create a message that includes a message ID and email text
data = {'MessageID': str(i),
'MessageBody': df['Message'][i]}
# Print the message so you can see what is being sent
print(f'Sending message: {data}')
# Send the data with the KafkaProducer client
producer.send(topic="emails", value=data)
print(f'Sent record to topic at time {dt.datetime.utcnow()}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment