Commit 7eb1a12f authored by lixiaofang's avatar lixiaofang

提交kafka的方式改变

parent 2aaf08e2
......@@ -2,4 +2,3 @@ import redis
from django.conf import settings
redis_client = redis.StrictRedis.from_url(settings.REDIS_URL)
redis_client2 = redis.StrictRedis.from_url(settings.REDIS_URL2)
......@@ -27,7 +27,7 @@ def kafka_consum(topic_name=None):
try:
while True:
msg_dict = consumser_obj.poll(timeout_ms=100, max_records=50)
consumser_obj.commit_async()
for msg_key in msg_dict:
consume_msg = msg_dict[msg_key]
for msg in consume_msg:
......@@ -112,7 +112,6 @@ def kafka_consum(topic_name=None):
save_data_to_kafka(card_info)
pass
consumser_obj.commit_async()
except:
consumser_obj.close()
logging_exception()
......
......@@ -17,7 +17,8 @@ def vest_irrigation(card_id=0, card_type=None, card_user_id=None, create_time=""
try:
producer = KafkaProducer(bootstrap_servers=[settings.KAFKA_BROKER_LIST])
logging.info("-----------------------------------------------")
logging.info("新数据进来了:%s" % card_id)
topic = settings.KAFKA_TOPIC_NAME
tag_list = ["瘦脸针kyc", "双眼皮kyc", "水光针kyc", "玻尿酸kyc", "吸脂kyc", "祛痘kyc", "鼻综合kyc", "光子嫩肤kyc", "没有想法kyc",
"牙齿kyc", "抗衰紧致kyc", "胸部kyc", "果酸换肤kyc", "祛斑kyc", "美白针kyc", "瘦腿针kyc"]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment