utils.py 455 B

12345678910111213141516171819
  1. import aiokafka.structs
  2. import json
  3. import time
  4. def record_factory():
  5. return aiokafka.structs.ConsumerRecord(
  6. topic="topic",
  7. partition=0,
  8. offset=0,
  9. timestamp=time.time() * 1000,
  10. timestamp_type=1,
  11. key="key",
  12. value=json.dumps({"schema": "Foo:1", "data": {"foo": "bar"}}).encode(),
  13. checksum="1",
  14. serialized_key_size=10,
  15. serialized_value_size=10,
  16. headers=[],
  17. )