package com.bonus.canteen.core.order.mq.listener;

import com.bonus.canteen.core.order.mq.MqPayload;
import com.bonus.canteen.core.pay.common.po.PayResultPO;
import com.bonus.common.houqin.mq.MQListener;
import com.bonus.common.houqin.mq.MQMessageListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;

@MQMessageListener(
   group = "order-order-v3-async-pay-result",
   topic = "order",
   tag = "order-v3-async-pay-result"
)
public class OrderMqListenerAsyncPayResult implements MQListener<MqPayload<String>> {
   private static final Logger log = LoggerFactory.getLogger(OrderMqListenerAsyncPayResult.class);
   @Autowired
   @Lazy
   private OrderMqHandler orderMqHandler;

   public void onMessage(MqPayload<String> payload) {
      this.orderMqHandler.handleMessage(payload, PayResultPO.class, OrderMqHandler::orderAsyncPayResult);
   }
}
