|
123456789101112131415161718 |
- # import sys
- # sys.path.extend(["..", "../util"])
- # from util.AliyunSdk import AliyunVodSdk
- # from concurrency.CommonThread import Common
- from kafka import KafkaProducer
- import json
- import threading
-
- topicName = 'dsp-alg-online-tasks'
- eBody = {
- "request_id": "d4c909912ac741ce81ccef03fd1b2ec45",
- "command": "stop"
- }
- producer = KafkaProducer(bootstrap_servers=['192.168.11.242:9092'],
- value_serializer=lambda m: json.dumps(m).encode('utf-8'))
- future = producer.send(topicName, key=b'd4c909912ac741ce81ccef03fd1b2ec45', value=eBody)
- result = future.get(timeout=10)
- print(result)
|