spring_amqp

138 阅读1分钟

1.铺垫

先有exchange 再有queue 再声明exchange绑定哪个queue 绑定的规则又是什么

2.消息

创建一个消息 指出要给哪个exchange发送消息 消息中携带的绑定规则是什么

3.配置文件

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>

4.消息转化

org.springframework.amqp.rabbit.core.RabbitTemplate private MessageConverter messageConverter = new SimpleMessageConverter();

5.注解ConditionalOnProperty

@ConditionalOnProperty(prefix = "rest", name = "auth-open", havingValue = "true", matchIfMissing = true)