티스토리 뷰
728x90
>>> # Serialize string keys
>>> producer = KafkaProducer(key_serializer=str.encode)
>>> producer.send('flipflap', key='ping', value=b'1234')
>>> # Serialize json messages
>>> import json
>>> producer = KafkaProducer(value_serializer=lambda v: json.dumps(v).encode('utf-8'))
>>> producer.send('fizzbuzz', {'foo': 'bar'})
https://kafka-python.readthedocs.io/en/master/index.html?highlight=key_serializer#kafkaproducer
kafka-python — kafka-python 2.0.2-dev documentation
Python client for the Apache Kafka distributed stream processing system. kafka-python is designed to function much like the official java client, with a sprinkling of pythonic interfaces (e.g., consumer iterators). kafka-python is best used with newer brok
kafka-python.readthedocs.io
728x90
'공부' 카테고리의 다른 글
[Avro] schema (multiple record, null default of record) & convertor (0) | 2022.05.14 |
---|---|
[Docker] naming rule: `docker/asdf.Dockerfile` (0) | 2022.05.14 |
[Python] Kafka Serializer (0) | 2022.05.14 |
[Slack] send message (0) | 2022.05.14 |
[Slack] https://slack.com/api/users.lookupByEmail (0) | 2022.05.08 |
[gradle] from maven `implementation(project(":data-core"))` (0) | 2022.05.08 |
댓글
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- 142,691
- Today
- 17
- Yesterday
- 219
TAG
- wlw
- 클루지
- Kluge
- Bot
- 책그림
- 어떻게 능력을 보여줄 것인가?
- follower
- COUNT
- 메디파크 내과 전문의 의학박사 김영수
- 인스타그램
- 팔로워 수 세기
- 개리마커스
- 김달
- 유투브
- 연애학개론