package org.jeecg.modules.mq;

import cn.hutool.core.util.RandomUtil;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

/**
 * @author wfansh
 */
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("dev")
public class RabbitMQTest {

    @Autowired private RabbitTemplate rabbitTemplate;

    @Test
    @Disabled
    public void testSendMessage() {
        int num = 10;
        for (int i = 0; i < num; i++) {
            rabbitTemplate.convertAndSend("site_enquiry", RandomUtil.randomString(12));
        }

        System.out.println("Sent messages to site_enquiry queue num = " + num);
    }
}
