package com.neusoft.smart.pos.mq;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import com.neusoft.smart.pos.mq.order.OrderMQReceiverHelper;
import com.neusoft.smart.pos.mq.payment.PaymentMQReceiverHelper;

@Profile(MQConfig.Impl.RABBIT_MQ)
@Component
public class TradeRabbitMQReceiver {
	
	@Autowired
	OrderMQReceiverHelper orderMQReceiverHelper;
	
	@Autowired
	PaymentMQReceiverHelper paymentMQReceiverHelper;
	
    @RabbitListener(queues = "file.uploaded.notify.queue1.name")
    public void processAccountCheckingMessage(String objectName) {
        orderMQReceiverHelper.doMessage(objectName);
    }
    
    @RabbitListener(queues = "login.queue1.name")
    public void processLoginMessage(byte[] content) {
    	paymentMQReceiverHelper.processLoginMessage(content);
    }

    @RabbitListener(queues = "order.complete.queue1.name")
    public void processOrderCompleteMessage(byte[] content) {
    	paymentMQReceiverHelper.processOrderCompleteMessage(content);
    }
}
