package com.bohuikeji.delivery.backstage.listener.examples;

import com.bohuikeji.delivery.backstage.service.ITOrderService;
import com.bohuikeji.frame.module.admin.base.MqListener;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * RabbitMq封装使用：消费者业务代码示例
 * @author Admin
 */
@Service
@RequiredArgsConstructor
public class TestListener extends MqListener<String> {

    final ITOrderService orderService;

    @Override
    public boolean onReceive(String msg) {
        System.out.println("TestListener接收到消息的："+msg);

        //int a=1/0;
        System.out.println("TestListener接收到消息的2222："+orderService.getByNum("666").getOrderId());
        return true;
    }

    @Override
    public void onError(String user, Exception e) {
        System.out.println("业务代码出现异常，可在此处进行处理！");

    }
}
