RabbitMq——direct交换器、fanout交换器、 topic交换器
direct交换器:
@Configuration
=发送=
@Bean
protected Queue queue(){
Queue queue = new Queue(“myQueue”)
return queue;
}
amqpTemplate.convertAndSend("myQueue","这是发送的内容"); 发送RabbitMq
发送成功
=接收=消费者(新项目)
@Conponent
@RabbitListener(queues=“myQueue”)注解某个方法为接收消息方法
public void Demo(String message){
}
@Conponent
(queues=“myQueue”)注解某个方法为接收消息方法
public void Demo2(String message){
}
fanout交换器 扇形交换器:
@Configuration
=发送=
@Bean
protected Queue createQueue1(){
Queue queue = new Queue(“myfanout1”)
return queue;
}
@Bean
protected Queue createQu