1 Star 0 Fork 0

github mirror/spring-boot

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
rabbit.groovy 704 Bytes
一键复制 编辑 原始数据 按行查看 历史
Scott Frederick 提交于 2020-02-05 04:23 +08:00 . Disambiguate a class in RabbitMQ CLI sample
package org.test
import java.util.concurrent.CountDownLatch
@Log
@Configuration(proxyBeanMethods = false)
@EnableRabbit
class RabbitExample implements CommandLineRunner {
private CountDownLatch latch = new CountDownLatch(1)
@Autowired
RabbitTemplate rabbitTemplate
void run(String... args) {
log.info "Sending RabbitMQ message..."
rabbitTemplate.convertAndSend("spring-boot", "Greetings from Spring Boot via RabbitMQ")
latch.await()
}
@RabbitListener(queues = 'spring-boot')
def receive(String message) {
log.info "Received ${message}"
latch.countDown()
}
@Bean
org.springframework.amqp.core.Queue queue() {
new org.springframework.amqp.core.Queue("spring-boot", false)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/github_mirror_plus/spring-boot.git
git@gitee.com:github_mirror_plus/spring-boot.git
github_mirror_plus
spring-boot
spring-boot
main

搜索帮助

371d5123 14472233 46e8bd33 14472233