Relocate projects to spring-boot-project
Move projects to better reflect the way that Spring Boot is released. The following projects are under `spring-boot-project`: - `spring-boot` - `spring-boot-autoconfigure` - `spring-boot-tools` - `spring-boot-starters` - `spring-boot-actuator` - `spring-boot-actuator-autoconfigure` - `spring-boot-test` - `spring-boot-test-autoconfigure` - `spring-boot-devtools` - `spring-boot-cli` - `spring-boot-docs` See gh-9316
This commit is contained in:
32
spring-boot-project/spring-boot-cli/samples/rabbit.groovy
Normal file
32
spring-boot-project/spring-boot-cli/samples/rabbit.groovy
Normal file
@@ -0,0 +1,32 @@
|
||||
package org.test
|
||||
|
||||
import java.util.concurrent.CountDownLatch
|
||||
|
||||
@Log
|
||||
@Configuration
|
||||
@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
|
||||
Queue queue() {
|
||||
new Queue("spring-boot", false)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user