CutDownPriceActivityConsumer.java 1.31 KB
package com.yoho.dsf.mqapi.consumer;

import com.alibaba.fastjson.JSONObject;
import com.yoho.core.rabbitmq.YhConsumer;
import com.yoho.dsf.mqapi.constants.MqConstants;
import com.yoho.dsf.mqapi.model.CutDownPriceActivity;
import com.yoho.dsf.mqapi.service.CutDownPriceActivityService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service(value="collageActivityConsumer")
public class CutDownPriceActivityConsumer implements YhConsumer {
	private static final Logger LOGGER = LoggerFactory.getLogger(CutDownPriceActivityConsumer.class);
	
	@Autowired
	private CutDownPriceActivityService cutDownPriceActivityService;

	@Override
	public void handleMessage(Object message) {
		LOGGER.info("begin CutDownPriceActivityConsumer.handleMessage message is:{}, topic is:{}", MqConstants.MQ_SYN_CUTDOWNPRICE_ACTIVITY);
		try {
			CutDownPriceActivity cutDownPriceActivity = JSONObject.parseObject(String.valueOf(message), CutDownPriceActivity.class);
			if (null != cutDownPriceActivity){
				cutDownPriceActivityService.updateCutDownPriceActivity(cutDownPriceActivity);
			}
		} catch (Exception e) {
			LOGGER.warn("handle CutDownPriceActivityConsumer info message failed!! message is " + String.valueOf(message),e);
		}
	}

}