@Autowired
AmqpAdmin amqpAdmin;
@Test
public void test(){
amqpAdmin.declareExchange(new DirectExchange("demo.exchange"));
amqpAdmin.declareQueue(new Queue("demo.queue",true));
amqpAdmin.declareBinding(new Binding("demo.queue",Binding.DestinationType.QUEUE,"demo.exchange","demo.routingKey",null));
}
SpringBoot中创建交换器、队列和绑定关系
最新推荐文章于 2024-11-25 07:07:33 发布
本文演示了如何使用Spring框架的@Autowired注解自动装配AmqpAdmin对象,通过它声明交换机、队列和绑定,实现了RabbitMQ的基本配置流程。
3370

被折叠的 条评论
为什么被折叠?



