Add auto compile tweaks for reactor
This commit is contained in:
@@ -1,18 +1,34 @@
|
||||
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"
|
||||
reactor.on(Selectors.$("hello"), [
|
||||
accept: {
|
||||
log.info("Hello ${it.data}")
|
||||
latch.countDown()
|
||||
}
|
||||
] as Consumer)
|
||||
}
|
||||
|
||||
void run(String... args) {
|
||||
reactor.notify("hello", Event.wrap("Phil"))
|
||||
log.info "Notified Phil"
|
||||
latch.await()
|
||||
}
|
||||
|
||||
@On(reactor="reactor", selector="hello")
|
||||
// @On(reactor="reactor", selector="hello")
|
||||
void receive(Event<String> event) {
|
||||
log.info "Hello ${event.data}"
|
||||
}
|
||||
|
||||
@@ -53,9 +53,12 @@ public class ReactorCompilerAutoConfiguration extends CompilerAutoConfiguration
|
||||
@Override
|
||||
public void applyImports(ImportCustomizer imports) {
|
||||
imports.addImports("reactor.core.Reactor", "reactor.event.Event",
|
||||
"reactor.function.Consumer", "reactor.function.Functions",
|
||||
"reactor.event.selector.Selectors",
|
||||
"reactor.spring.context.annotation.On",
|
||||
"reactor.spring.context.annotation.Reply",
|
||||
EnableReactor.class.getCanonicalName());
|
||||
EnableReactor.class.getCanonicalName()).addStarImports(
|
||||
"reactor.event.Selectors");
|
||||
}
|
||||
|
||||
@Target(ElementType.TYPE)
|
||||
|
||||
Reference in New Issue
Block a user