测试延迟消息,创建queue

This commit is contained in:
jieyuu 2024-09-02 16:09:12 +08:00
parent b5bfe6de1b
commit 26b1ece7ea

View File

@ -0,0 +1,26 @@
package net.jieyuu.biz;
import lombok.extern.slf4j.Slf4j;
import net.jieyuu.ProductApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
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.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ProductApplication.class)
@Slf4j
public class DemoApplicationTests {
@Autowired
private RabbitTemplate rabbitTemplate;
@Test
public void send(){
rabbitTemplate.convertAndSend("stock.event.exchange","stock.release.delay.routing.key","23342342");
}
}