package com.diagbot.rabbit;

import com.diagbot.facade.BuriedSomeStatisticalFacade;
import com.diagbot.util.GsonUtil;
import com.diagbot.vo.BuriedSomeStatisticalVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;

/**
 * @Description: 消费者
 * @author: gaodm
 * @time: 2018/8/29 14:02
 */
@EnableBinding({ MyProcessor.class })
public class MyReceiver {
    @Autowired
    BuriedSomeStatisticalFacade buriedSomeStatisticalFacade;

    @StreamListener(MyProcessor.INPUT_POINT)
    public void inputPoint(String message) {
        System.out.println("Received <" + "数据埋点数据" + ">");
        BuriedSomeStatisticalVO buriedSomeStatisticalVO = GsonUtil.toObject(message, BuriedSomeStatisticalVO.class);
        buriedSomeStatisticalFacade.saveBuriedSomeStatistical(buriedSomeStatisticalVO);
    }
}
