Commit ec3c5b53 authored by Dave Syer's avatar Dave Syer

Add auto compile tweaks for reactor

parent 9cf59050
...@@ -15,3 +15,4 @@ dependency-reduced-pom.xml ...@@ -15,3 +15,4 @@ dependency-reduced-pom.xml
build.log build.log
_site/ _site/
.*.md.html .*.md.html
manifest.yml
package org.test package org.test
import java.util.concurrent.CountDownLatch;
@EnableReactor @EnableReactor
@Log @Log
class Runner implements CommandLineRunner { class Runner implements CommandLineRunner {
@Autowired @Autowired
Reactor reactor 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) { void run(String... args) {
reactor.notify("hello", Event.wrap("Phil")) reactor.notify("hello", Event.wrap("Phil"))
log.info "Notified Phil" log.info "Notified Phil"
latch.await()
} }
@On(reactor="reactor", selector="hello") // @On(reactor="reactor", selector="hello")
void receive(Event<String> event) { void receive(Event<String> event) {
log.info "Hello ${event.data}" log.info "Hello ${event.data}"
} }
......
...@@ -53,9 +53,12 @@ public class ReactorCompilerAutoConfiguration extends CompilerAutoConfiguration ...@@ -53,9 +53,12 @@ public class ReactorCompilerAutoConfiguration extends CompilerAutoConfiguration
@Override @Override
public void applyImports(ImportCustomizer imports) { public void applyImports(ImportCustomizer imports) {
imports.addImports("reactor.core.Reactor", "reactor.event.Event", 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.On",
"reactor.spring.context.annotation.Reply", "reactor.spring.context.annotation.Reply",
EnableReactor.class.getCanonicalName()); EnableReactor.class.getCanonicalName()).addStarImports(
"reactor.event.Selectors");
} }
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<main.basedir>${basedir}/..</main.basedir> <main.basedir>${basedir}/..</main.basedir>
</properties> </properties>
<dependencies> <dependencies>
<!-- Ensure other reactor projects are build before running integration tests --> <!-- Ensure other reactor projects are built before running integration tests -->
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
<artifactId>spring-boot</artifactId> <artifactId>spring-boot</artifactId>
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<!-- Invoke integration tests in the install phase, after the spring-package-maven-plugin is available --> <!-- Invoke integration tests in the install phase, after the maven-plugin is available -->
<artifactId>maven-invoker-plugin</artifactId> <artifactId>maven-invoker-plugin</artifactId>
<configuration> <configuration>
<settingsFile>src/it/settings.xml</settingsFile> <settingsFile>src/it/settings.xml</settingsFile>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment