Skip to content

Instantly share code, notes, and snippets.

@merlin-quix
Last active January 22, 2023 14:56
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/44add083a4fb0c5b5c4b016ed5000f97 to your computer and use it in GitHub Desktop.
Save merlin-quix/44add083a4fb0c5b5c4b016ed5000f97 to your computer and use it in GitHub Desktop.
producer_compression = KafkaProducer(bootstrap_servers=['localhost:9092'],
value_serializer=lambda x:json.dumps(x, default=str).encode('utf-8'),
key_serializer=lambda y:str(y).encode("utf-8"),
compression_type="gzip",
linger_ms=1000,
batch_size=10485760)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment