Improved module name <functional-area>-<Command|Query>....
Standalone services now use the Event Store Server (many tests still use the embedded server)
This commit is contained in:
11
java-spring/common-web/build.gradle
Normal file
11
java-spring/common-web/build.gradle
Normal file
@@ -0,0 +1,11 @@
|
||||
apply plugin: 'java'
|
||||
|
||||
dependencies {
|
||||
compile project(":testutil")
|
||||
compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
|
||||
|
||||
testCompile "junit:junit:4.11"
|
||||
testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package net.chrisrichardson.eventstore.javaexamples.banking.web.util;
|
||||
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
import rx.Observable;
|
||||
import rx.Subscriber;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class DeferredUtils {
|
||||
|
||||
public static <T> DeferredResult<T> toDeferredResult(Observable<T> o) {
|
||||
final DeferredResult<T> d = new DeferredResult<T>();
|
||||
final AtomicReference<T> r = new AtomicReference<T>();
|
||||
|
||||
o.single().subscribe(new Subscriber<T>() {
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
d.setResult(r.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
d.setErrorResult(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(T t) {
|
||||
r.set(t);
|
||||
}
|
||||
});
|
||||
return d;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user