package com.tax.file.service.async.apply;

import com.rabbitmq.client.Channel;
import com.tax.file.model.TkTaxUser;
import com.tax.file.service.async.ExecuteMqService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class FileApplyReceiver {

    @Autowired
    private ExecuteMqService asyncTkFileApplyService;

    @RabbitListener(queues="${spring.rabbitmq.queue.testApplyFile}",containerFactory="rabbitListenerContainerFactory")
    public void process(TkTaxUser taxUser, Channel channel, @Headers Map<String, Object> headers) throws Exception {
        asyncTkFileApplyService.execute(taxUser);
    }
}
