Merge remote-tracking branch 'remotes/upstream/wip-eventuate-client-java' into wip-customer

This commit is contained in:
Main
2016-07-25 23:06:05 +03:00
105 changed files with 392 additions and 704 deletions

View File

@@ -2,7 +2,6 @@ apply plugin: 'java'
dependencies {
compile project(":customers-query-side-backend")
compile project(":common-web")
compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"

View File

@@ -1,15 +1,13 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web.customers.queryside;
import net.chrisrichardson.eventstore.EntityIdentifier;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.customers.CustomerQueryService;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.QuerySideCustomer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import rx.Observable;
import java.util.List;
import java.util.concurrent.CompletableFuture;
/**
* Created by Main on 05.02.2016.
@@ -25,14 +23,14 @@ public class CustomerQueryController {
}
@RequestMapping(value = "/customers/{customerId}", method = RequestMethod.GET)
public Observable<QuerySideCustomer> getCustomer(@PathVariable String customerId) {
return customerQueryService.findByCustomerId(new EntityIdentifier(customerId));
public CompletableFuture<QuerySideCustomer> getCustomer(@PathVariable String customerId) {
return customerQueryService.findByCustomerId(customerId);
}
@RequestMapping(value = "/customers", method = RequestMethod.GET)
public Observable<CustomersQueryResponse> getCustomersByEmail(@RequestParam String email) {
public CompletableFuture<CustomersQueryResponse> getCustomersByEmail(@RequestParam String email) {
return customerQueryService.findByEmail(email)
.map(this::getCustomersQueryResponse);
.thenApply(this::getCustomersQueryResponse);
}

View File

@@ -1,6 +1,5 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web.customers.queryside;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerResponse;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.QuerySideCustomer;
import java.util.List;

View File

@@ -1,33 +1,13 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web.customers.queryside;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.customers.QuerySideCustomerConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.web.util.ObservableReturnValueHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
import java.util.ArrayList;
import java.util.List;
@Configuration
@Import({QuerySideCustomerConfiguration.class})
@ComponentScan
public class CustomersQuerySideWebConfiguration extends WebMvcConfigurerAdapter {
class FakeThing {
}
@Bean
public FakeThing init(RequestMappingHandlerAdapter adapter) {
// https://jira.spring.io/browse/SPR-13083
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<HandlerMethodReturnValueHandler>(adapter.getReturnValueHandlers());
handlers.add(0, new ObservableReturnValueHandler());
adapter.setReturnValueHandlers(handlers);
return new FakeThing();
}
}