From ec3c5b532128012200195049aca8045b3e396d7c Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Tue, 30 Jul 2013 22:03:56 +0100 Subject: [PATCH] Add auto compile tweaks for reactor --- .gitignore | 1 + spring-boot-cli/samples/reactor.groovy | 18 +++++++++++++++++- .../ReactorCompilerAutoConfiguration.java | 5 ++++- spring-boot-integration-tests/pom.xml | 4 ++-- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 13084699e3..1126d44ff8 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ dependency-reduced-pom.xml build.log _site/ .*.md.html +manifest.yml diff --git a/spring-boot-cli/samples/reactor.groovy b/spring-boot-cli/samples/reactor.groovy index 9b1ebd84bc..d8c98ae776 100644 --- a/spring-boot-cli/samples/reactor.groovy +++ b/spring-boot-cli/samples/reactor.groovy @@ -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 event) { log.info "Hello ${event.data}" } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/ReactorCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/ReactorCompilerAutoConfiguration.java index d6d61f2f9e..c74e0e8a71 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/ReactorCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/ReactorCompilerAutoConfiguration.java @@ -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) diff --git a/spring-boot-integration-tests/pom.xml b/spring-boot-integration-tests/pom.xml index 075efd6f0d..2fe4782c8c 100644 --- a/spring-boot-integration-tests/pom.xml +++ b/spring-boot-integration-tests/pom.xml @@ -13,7 +13,7 @@ ${basedir}/.. - + ${project.groupId} spring-boot @@ -104,7 +104,7 @@ - + maven-invoker-plugin src/it/settings.xml