import logging
from typing import Dict, Any

from confluent_kafka import Message

logger = logging.getLogger(__name__)


def handle_message(payload: Dict[str, Any], msg: Message):
    try:
        logger.info('kafka handle, payload:{} msg:{}'.format(payload, [msg.topic(), msg.partition(), msg.offset()]))
        # 幂等、失败重试、全部成功后再ack
    except BizExc as exc:
        # 业务异常不重试(如:并发锁)
        logger.error('handle_message, exc:{}'.format(repr(exc)))
