package cn.bunny.module.rabbitMQ.consumer;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class DirectConsumer {
    @Autowired
    RabbitTemplate rabbitTemplate;

    /**
     * 发送红色消息
     */
    @Test
    void testSendDirectRed() throws Exception {
        for (int i = 0; i < 1000; i++) {
            rabbitTemplate.convertAndSend("bunny.direct", "red", "发送消息：" + i);
        }
    }
}
