You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spring-boot/spring-boot-cli/samples/reactor.groovy

31 lines
529 B
Groovy

package org.test
import java.util.concurrent.CountDownLatch;
@EnableReactor
@Log
class Runner implements CommandLineRunner {
11 years ago
@Autowired
Reactor reactor
11 years ago
private CountDownLatch latch = new CountDownLatch(1)
11 years ago
@PostConstruct
void init() {
log.info "Registering consumer"
}
void run(String... args) {
reactor.notify("hello", Event.wrap("Phil"))
log.info "Notified Phil"
latch.await()
}
11 years ago
@Selector(reactor="reactor", value="hello")
void receive(String data) {
log.info "Hello ${data}"
latch.countDown()
11 years ago
}
}