You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
529 B
30 lines
529 B
package org.test |
|
|
|
import java.util.concurrent.CountDownLatch; |
|
|
|
@EnableReactor |
|
@Log |
|
class Runner implements CommandLineRunner { |
|
|
|
@Autowired |
|
Reactor reactor |
|
|
|
private CountDownLatch latch = new CountDownLatch(1) |
|
|
|
@PostConstruct |
|
void init() { |
|
log.info "Registering consumer" |
|
} |
|
|
|
void run(String... args) { |
|
reactor.notify("hello", Event.wrap("Phil")) |
|
log.info "Notified Phil" |
|
latch.await() |
|
} |
|
|
|
@Selector(reactor="reactor", value="hello") |
|
void receive(String data) { |
|
log.info "Hello ${data}" |
|
latch.countDown() |
|
} |
|
}
|
|
|