package com.neusoft.smart.pos.mq;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import com.neusoft.smart.pos.mq.aliyunRocketMq.AliyunRocketMqConsumer;
import com.neusoft.smart.pos.mq.aliyunRocketMq.EnumMsgTopic;
import com.neusoft.smart.pos.mq.aliyunRocketMq.EnumMsgTopicTags;
import com.neusoft.smart.pos.mq.order.OrderMQReceiverHelper;
import com.neusoft.smart.pos.mq.payment.PaymentMQReceiverHelper;
import com.neusoft.smart.pos.mq.MQConfig;

@Component
@Profile(MQConfig.Impl.ALIYUN_ROCKET_MQ)
public class TradeAliyunRocketMQReceiver extends AliyunRocketMqConsumer{

	@Autowired
	OrderMQReceiverHelper orderMQReceiverHelper;
	
	@Autowired
	PaymentMQReceiverHelper paymentMQReceiverHelper;
	
	
	@Override
	protected void doMessage(String topic,String tag,String msg) {
		if (EnumMsgTopic.LOGIN.getTopic().equals(topic) && EnumMsgTopicTags.LOGIN_QUEUE1.getTags().equals(tag)) {
			paymentMQReceiverHelper.processLoginStringMessage(msg);
		}else if (EnumMsgTopic.ORDER_COMPLETE.getTopic().equals(topic) && EnumMsgTopicTags.ORDER_COMPLETE_QUEUE1.getTags().equals(tag)) {
			paymentMQReceiverHelper.processOrderCompleteStringMessage(msg);
		}
	}

}
