Merge remote-tracking branch 'remotes/upstream/master'

This commit is contained in:
dartpopikyardo
2017-01-19 02:05:41 +03:00
148 changed files with 531 additions and 822 deletions

View File

@@ -35,27 +35,16 @@ The following diagram shows the architecture:
![Money transfer architecture](https://github.com/cer/event-sourcing-examples/wiki/i/applicationarchitecture.png)
There are the following logical services:
There are the following services:
* Customers (command-side) - REST API for creating customers
* Accounts (command-side) - REST API for creating accounts
* Money transfers (command-side) - REST API for transferring money
* Customers (query-side) - subscribes to events and updates a MongoDB View, and provides an API for retrieving customers
* Accounts (query-side) - subscribes to events and updates a MongoDB View, and provides an API for retrieving accounts
* Customers Service - REST API for creating customers
* Accounts Service - REST API for creating accounts
* Transactions Service - REST API for transferring money
* Customers View Service - subscribes to events and updates a MongoDB View, and provides an API for retrieving customers
* Accounts View Service - subscribes to events and updates a MongoDB View, and provides an API for retrieving accounts
There is also an [API gateway](http://microservices.io/patterns/apigateway.html) service that acts as a Facade in front of the services.
One of the neat things about the modular architecture is that there are two ways to deploy these four services:
* monolithic-service - all services are packaged as a single Spring Boot executable JAR
* Microservices - three separate Spring Boot executable JARs
* customer-command-side-service - command-side customers
* accounts-command-side-service - command-side accounts
* transactions-command-side-service - command-side money transfers
* customers-query-side-service - query-side customers
* accounts-query-side-service - query-side accounts
* api-gateway-service - API gateway service
# About the examples
There are currently the following versions of the example application:

View File

@@ -47,7 +47,7 @@ fi
export SERVICE_HOST=$DOCKER_HOST_IP
./gradlew $* build -x :e2e-test:test
./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS $* build -x :e2e-test:test
if [ -z "$EVENTUATE_LOCAL" ] && [ -z "$EVENTUATE_API_KEY_ID" -o -z "$EVENTUATE_API_KEY_SECRET" ] ; then
echo You must set EVENTUATE_API_KEY_ID and EVENTUATE_API_KEY_SECRET
@@ -58,11 +58,11 @@ ${DOCKER_COMPOSE?} build
${DOCKER_COMPOSE?} up -d
$DIR/wait-for-services.sh $DOCKER_HOST_IP 8080 8081 8082
$DIR/wait-for-services.sh $DOCKER_HOST_IP 8080 8081 8082 8083 8084
set -e
./gradlew -a $* :e2e-test:cleanTest :e2e-test:test -P ignoreE2EFailures=false
./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS -a $* :e2e-test:cleanTest :e2e-test:test -P ignoreE2EFailures=false
if [ $NO_RM = false ] ; then
${DOCKER_COMPOSE?} stop

View File

@@ -2,34 +2,10 @@ This is the Java/Spring version of the Event Sourcing/CQRS money transfer exampl
# About the application
This application consists of three microservices:
This application consists of the following microservices:
* Account Service - the command side business logic for Accounts
* Money Transfer Service - the command side business logic for Money Transfers
* Query service - query side implementation of a MongoDB-based, denormalized view of Accounts and MoneyTransfers
The Account Service consists of the following modules:
* accounts-command-side-backend - the Account aggregate
* accounts-command-side-web - a REST API for creating and retrieving Accounts
* accounts-command-side-service - a standalone microservice
The Money Transfer Service consists of the following modules:
* transactions-command-side-backend - the MoneyTransfer aggregate
* transactions-command-side-web - a REST API for creating and retrieving Money Transfers
* transactions-command-side-service - a standalone microservice
The Query Service consists the following modules:
* accounts-query-side-backend - MongoDB-based, denormalized view of Accounts and MoneyTransfers
* accounts-query-side-web - a REST API for querying the denormalized view
* accounts-query-side-service - a standalone microservice
# Deploying the application
These services can be deployed either as either separate standalone services using the Event Store server, or they can be deployed as a monolithic application for simplified integration testing.
The three services can also be packaged as a single monolithic web application in order to be used with the embedded Event Store:
* monolithic-service - all-in-one, monolithic packaging of the application
* Account View Service - query side implementation of a MongoDB-based, denormalized view of Accounts
* Customer Service - the command side business logic for Customers
* Customer View Service - query side implementation of a MongoDB-based, denormalized view of Customers
* Transaction Service - the command side business logic for Money Transfers

View File

@@ -1,14 +0,0 @@
apply plugin: 'java'
dependencies {
compile project(":common-backend")
compile "io.eventuate.client.java:eventuate-client-java-spring:$eventuateClientVersion"
testCompile project(":testutil")
testCompile "junit:junit:4.11"
testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion"
}

View File

@@ -1,7 +0,0 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts;
import io.eventuate.Command;
interface AccountCommand extends Command {
}

View File

@@ -1,4 +0,0 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts;
public class DeleteAccountCommand implements AccountCommand {
}

View File

@@ -1,4 +0,0 @@
FROM java:openjdk-8u91-jdk
CMD java ${JAVA_OPTS} -jar accounts-command-side-service.jar
EXPOSE 8080
COPY build/libs/accounts-command-side-service.jar .

View File

@@ -1,20 +0,0 @@
apply plugin: VerifyMongoDBConfigurationPlugin
apply plugin: VerifyEventStoreEnvironmentPlugin
apply plugin: EventuateDependencyPlugin
apply plugin: 'spring-boot'
dependencies {
compile project(":accounts-command-side-web")
compile project(":common-swagger")
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.springframework.boot:spring-boot-starter-actuator"
testCompile "org.springframework.boot:spring-boot-starter-test"
}
test {
ignoreFailures System.getenv("EVENTUATE_API_KEY_ID") == null
}

View File

@@ -1,11 +0,0 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web.main;
import net.chrisrichardson.eventstore.javaexamples.banking.web.AccountsCommandSideServiceConfiguration;
import org.springframework.boot.SpringApplication;
public class AccountsCommandSideServiceMain {
public static void main(String[] args) {
SpringApplication.run(AccountsCommandSideServiceConfiguration.class, args);
}
}

View File

@@ -1,12 +0,0 @@
dependencies {
compile project(":accounts-command-side-backend")
compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion"
}

View File

@@ -1,16 +0,0 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web.commandside.accounts;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts.AccountConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
@Import({AccountConfiguration.class})
@ComponentScan
@EnableAutoConfiguration
public class CommandSideWebAccountsConfiguration {
}

View File

@@ -1,11 +0,0 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web.commandside.accounts;
import io.eventuate.javaclient.spring.jdbc.EventuateJdbcEventStoreConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
@Import({CommandSideWebAccountsConfiguration.class, EventuateJdbcEventStoreConfiguration.class})
public class AccountControllerIntegrationTestConfiguration {
}

View File

@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- [%thread] -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</Pattern>
</layout>
</appender>
<root level="error">
<appender-ref ref="STDOUT" />
</root>
<logger name="org.springframework.web" level='debug'>
</logger>
</configuration>

View File

@@ -1,4 +0,0 @@
FROM java:openjdk-8u91-jdk
CMD java ${JAVA_OPTS} -jar accounts-query-side-service.jar
EXPOSE 8080
COPY build/libs/accounts-query-side-service.jar .

View File

@@ -1,11 +0,0 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web.main;
import net.chrisrichardson.eventstore.javaexamples.banking.web.AccountsQuerySideServiceConfiguration;
import org.springframework.boot.SpringApplication;
public class AccountsQuerySideServiceMain {
public static void main(String[] args) {
SpringApplication.run(AccountsQuerySideServiceConfiguration.class, args);
}
}

View File

@@ -1,10 +0,0 @@
dependencies {
compile project(":accounts-query-side-backend")
compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"
}

View File

@@ -1,14 +0,0 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web.queryside;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts.QuerySideAccountConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
@Import({QuerySideAccountConfiguration.class})
@ComponentScan
public class QuerySideWebConfiguration {
}

View File

@@ -0,0 +1,4 @@
FROM java:openjdk-8u91-jdk
CMD java ${JAVA_OPTS} -jar accounts-service.jar
EXPOSE 8080
COPY build/libs/accounts-service.jar .

View File

@@ -1,18 +1,17 @@
apply plugin: VerifyMongoDBConfigurationPlugin
apply plugin: VerifyEventStoreEnvironmentPlugin
apply plugin: EventuateDependencyPlugin
apply plugin: 'spring-boot'
dependencies {
compile project(":customers-query-side-web")
compile project(":common-backend")
compile project(":common-swagger")
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.springframework.boot:spring-boot-starter-actuator"
testCompile project(":testutil")
testCompile project(":customers-command-side-service")
testCompile "junit:junit:4.11"
testCompile "org.springframework.boot:spring-boot-starter-test"
testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion"
}
@@ -20,4 +19,3 @@ dependencies {
test {
ignoreFailures System.getenv("EVENTUATE_API_KEY_ID") == null
}

View File

@@ -0,0 +1,21 @@
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice;
import io.eventuate.javaclient.driver.EventuateDriverConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.web.AccountsWebConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.commonswagger.CommonSwaggerConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
@Import({AccountsWebConfiguration.class, EventuateDriverConfiguration.class, CommonSwaggerConfiguration.class})
@EnableAutoConfiguration
@ComponentScan
public class AccountsServiceMain {
public static void main(String[] args) {
SpringApplication.run(AccountsServiceMain.class, args);
}
}

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend;
import io.eventuate.Event;
import io.eventuate.EventUtil;
@@ -7,7 +7,6 @@ import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.accoun
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class Account extends ReflectiveMutableCommandProcessingAggregate<Account, AccountCommand> {

View File

@@ -0,0 +1,7 @@
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend;
import io.eventuate.Command;
interface AccountCommand extends Command {
}

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend;
import io.eventuate.AggregateRepository;

View File

@@ -1,11 +1,10 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend;
import io.eventuate.EntityWithIdAndVersion;
import io.eventuate.EventHandlerContext;
import io.eventuate.EventHandlerMethod;
import io.eventuate.EventSubscriber;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.customers.CustomerToAccountDeleted;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.transactions.DebitRecordedEvent;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.transactions.MoneyTransferCreatedEvent;

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend;
import io.eventuate.AggregateRepository;
import io.eventuate.EventuateAggregateStore;
@@ -8,7 +8,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@EnableEventHandlers
public class AccountConfiguration {
public class AccountsBackendConfiguration {
@Bean
public AccountWorkflow accountWorkflow() {

View File

@@ -1,7 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts;
import io.eventuate.Aggregate;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend;
import java.math.BigDecimal;

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend;
import java.math.BigDecimal;

View File

@@ -0,0 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend;
public class DeleteAccountCommand implements AccountCommand {
}

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend;
import java.math.BigDecimal;

View File

@@ -1,6 +1,6 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web.commandside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.web;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts.AccountService;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend.AccountService;
import net.chrisrichardson.eventstore.javaexamples.banking.common.accounts.CreateAccountRequest;
import net.chrisrichardson.eventstore.javaexamples.banking.common.accounts.CreateAccountResponse;
import net.chrisrichardson.eventstore.javaexamples.banking.common.accounts.DeleteAccountResponse;

View File

@@ -0,0 +1,15 @@
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.web;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend.AccountsBackendConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
@Import({AccountsBackendConfiguration.class})
@ComponentScan
public class AccountsWebConfiguration {
}

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice;
import net.chrisrichardson.eventstore.javaexamples.banking.common.accounts.CreateAccountRequest;
import net.chrisrichardson.eventstore.javaexamples.banking.common.accounts.CreateAccountResponse;
@@ -33,10 +33,9 @@ public class AccountsCommandSideServiceIntegrationTest {
@Test
public void shouldCreateAccountsAndTransferMoney() {
public void shouldCreateAccounts() {
BigDecimal initialFromAccountBalance = new BigDecimal(500);
BigDecimal initialToAccountBalance = new BigDecimal(100);
BigDecimal amountToTransfer = new BigDecimal(150);
String customerId = "00000000-00000000";
String title = "My Account";
@@ -48,8 +47,6 @@ public class AccountsCommandSideServiceIntegrationTest {
Assert.assertNotNull(fromAccountId);
Assert.assertNotNull(toAccountId);
}

View File

@@ -1,5 +1,8 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.web.AccountsWebConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.commonauth.AuthConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -12,7 +15,8 @@ import java.util.Arrays;
import java.util.List;
@Configuration
@Import(AccountsCommandSideServiceConfiguration.class)
@Import({AccountsWebConfiguration.class, AuthConfiguration.class})
@EnableAutoConfiguration
public class AccountsCommandSideServiceTestConfiguration {
@Bean

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend;
import net.chrisrichardson.eventstorestore.javaexamples.testutil.AbstractEntityEventTest;

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend;
import io.eventuate.Event;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.accounts.AccountOpenedEvent;

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web.commandside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.web;
import org.junit.Before;
import org.junit.Test;

View File

@@ -0,0 +1,13 @@
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.web;
import io.eventuate.javaclient.spring.jdbc.EmbeddedTestAggregateStoreConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
@Import({AccountsWebConfiguration.class, EmbeddedTestAggregateStoreConfiguration.class})
@EnableAutoConfiguration
public class AccountControllerIntegrationTestConfiguration {
}

View File

@@ -0,0 +1,4 @@
FROM java:openjdk-8u91-jdk
CMD java ${JAVA_OPTS} -jar accounts-view-service.jar
EXPOSE 8080
COPY build/libs/accounts-view-service.jar .

View File

@@ -1,8 +1,15 @@
apply plugin: 'java'
apply plugin: VerifyMongoDBConfigurationPlugin
apply plugin: VerifyEventStoreEnvironmentPlugin
apply plugin: EventuateDependencyPlugin
apply plugin: 'spring-boot'
dependencies {
compile project(":common-swagger")
compile project(":common-backend")
compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"
compile "io.eventuate.client.java:eventuate-client-java-spring:$eventuateClientVersion"
compile "org.springframework.boot:spring-boot-starter-data-mongodb:$springBootVersion"
@@ -10,6 +17,8 @@ dependencies {
testCompile "junit:junit:4.11"
testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion"
}
test {
ignoreFailures System.getenv("EVENTUATE_API_KEY_ID") == null
}

View File

@@ -0,0 +1,21 @@
package net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice;
import io.eventuate.javaclient.driver.EventuateDriverConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.web.AccountViewWebConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.commonswagger.CommonSwaggerConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
@Import({AccountViewWebConfiguration.class, EventuateDriverConfiguration.class, CommonSwaggerConfiguration.class})
@EnableAutoConfiguration
@ComponentScan
public class AccountsViewServiceMain {
public static void main(String[] args) {
SpringApplication.run(AccountsViewServiceMain.class, args);
}
}

View File

@@ -1,9 +1,8 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend;
import com.fasterxml.jackson.annotation.JsonProperty;
import net.chrisrichardson.eventstore.javaexamples.banking.common.accounts.AccountChangeInfo;
import net.chrisrichardson.eventstore.javaexamples.banking.common.accounts.AccountTransactionInfo;
import net.chrisrichardson.eventstore.javaexamples.banking.common.transactions.TransferState;
import java.util.*;

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend;
import org.springframework.data.mongodb.repository.MongoRepository;

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend;
import com.mongodb.WriteResult;
import io.eventuate.Int128;
@@ -15,7 +15,7 @@ import org.springframework.data.mongodb.core.query.Update;
import java.math.BigDecimal;
import java.util.Date;
import static net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts.MoneyUtil.toIntegerRepr;
import static net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend.MoneyUtil.toIntegerRepr;
import static org.springframework.data.mongodb.core.query.Criteria.where;
public class AccountInfoUpdateService {

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend;
public class AccountNotFoundException extends RuntimeException {

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend;
import java.util.List;

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend;
import io.eventuate.DispatchedEvent;
import io.eventuate.EventHandlerMethod;
@@ -16,10 +16,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.math.BigDecimal;
import java.util.Date;
import static net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts.MoneyUtil.toIntegerRepr;
import static net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend.MoneyUtil.toIntegerRepr;
@EventSubscriber(id="querySideEventHandlers")
public class AccountQueryWorkflow {

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend;
import io.eventuate.javaclient.spring.EnableEventHandlers;
@@ -10,7 +10,7 @@ import org.springframework.data.mongodb.repository.config.EnableMongoRepositorie
@Configuration
@EnableMongoRepositories
@EnableEventHandlers
public class QuerySideAccountConfiguration {
public class AccountViewBackendConfiguration {
@Bean
public AccountQueryWorkflow accountQueryWorkflow(AccountInfoUpdateService accountInfoUpdateService) {

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend;
import java.math.BigDecimal;

View File

@@ -1,11 +1,10 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.mongodb.core.MongoTemplate;
import javax.annotation.PostConstruct;
import java.util.concurrent.TimeUnit;
public class QuerySideDependencyChecker {
private Logger logger = LoggerFactory.getLogger(getClass());

View File

@@ -1,9 +1,8 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web.queryside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.web;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts.AccountInfo;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts.AccountNotFoundException;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts.AccountQueryService;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend.AccountInfo;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend.AccountNotFoundException;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend.AccountQueryService;
import net.chrisrichardson.eventstore.javaexamples.banking.common.accounts.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@@ -58,7 +57,7 @@ public class AccountQueryController {
return ResponseEntity.ok().body(new AccountHistoryResponse(historyEntries));
}
@ResponseStatus(value= HttpStatus.NOT_FOUND, reason="account not found")
@ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "account not found")
@ExceptionHandler(AccountNotFoundException.class)
public void accountNotFound() {
}

View File

@@ -1,9 +1,6 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web;
package net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.web;
import io.eventuate.javaclient.spring.httpstomp.EventuateHttpStompClientConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.commonswagger.CommonSwaggerConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.web.queryside.QuerySideWebConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend.AccountViewBackendConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -13,11 +10,9 @@ import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
@Configuration
@Import({QuerySideWebConfiguration.class, EventuateHttpStompClientConfiguration.class, CommonSwaggerConfiguration.class})
@EnableAutoConfiguration
@Import({AccountViewBackendConfiguration.class})
@ComponentScan
public class AccountsQuerySideServiceConfiguration {
public class AccountViewWebConfiguration {
@Bean
public HttpMessageConverters customConverters() {

View File

@@ -1,9 +1,13 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts;
package net.chrisrichardson.eventstore.javaexamples.banking.web;
import io.eventuate.Int128;
import io.eventuate.javaclient.spring.jdbc.EventuateJdbcEventStoreConfiguration;
import io.eventuate.javaclient.spring.jdbc.IdGenerator;
import io.eventuate.javaclient.spring.jdbc.IdGeneratorImpl;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend.AccountInfo;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend.AccountInfoUpdateService;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend.AccountQueryService;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend.AccountViewBackendConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.accounts.AccountCreditedEvent;
import net.chrisrichardson.eventstore.javaexamples.banking.common.accounts.AccountChangeInfo;
import net.chrisrichardson.eventstore.javaexamples.banking.common.accounts.AccountTransactionInfo;
@@ -31,7 +35,7 @@ public class AccountInfoUpdateServiceTest {
@Configuration
@EnableAutoConfiguration
@Import({QuerySideAccountConfiguration.class, EventuateJdbcEventStoreConfiguration.class})
@Import({AccountViewBackendConfiguration.class, EventuateJdbcEventStoreConfiguration.class})
public static class AccountInfoUpdateServiceTestConfiguration {
}

View File

@@ -1,7 +1,12 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web;
import io.eventuate.javaclient.spring.jdbc.EmbeddedTestAggregateStoreConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.web.AccountViewWebConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.commonswagger.CommonSwaggerConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
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.http.converter.HttpMessageConverter;
@@ -12,7 +17,9 @@ import java.util.Arrays;
import java.util.List;
@Configuration
@Import(AccountsQuerySideServiceConfiguration.class)
@Import({AccountViewWebConfiguration.class, EmbeddedTestAggregateStoreConfiguration.class, CommonSwaggerConfiguration.class})
@EnableAutoConfiguration
@ComponentScan
public class AccountsQuerySideServiceTestConfiguration {
@Bean

View File

@@ -2,11 +2,11 @@ apply plugin: VerifyMongoDBConfigurationPlugin
dependencies {
testCompile project(":accounts-command-side-backend")
testCompile project(":transactions-command-side-backend")
testCompile project(":accounts-query-side-backend")
testCompile project(":customers-command-side-backend")
testCompile project(":customers-query-side-backend")
testCompile project(":transactions-service")
testCompile project(":accounts-service")
testCompile project(":accounts-view-service")
testCompile project(":customers-service")
testCompile project(":customers-view-service")
testCompile project(":testutil")
testCompile "junit:junit:4.11"
testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"

View File

@@ -1,15 +1,14 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend;
import io.eventuate.javaclient.spring.jdbc.EventuateJdbcEventStoreConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts.AccountConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.transactions.MoneyTransferConfiguration;
import io.eventuate.javaclient.spring.jdbc.EmbeddedTestAggregateStoreConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend.AccountsBackendConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.transactionsservice.backend.MoneyTransferBackendConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@Configuration
@Import({AccountConfiguration.class, MoneyTransferConfiguration.class, EventuateJdbcEventStoreConfiguration.class})
@Import({AccountsBackendConfiguration.class, MoneyTransferBackendConfiguration.class, EmbeddedTestAggregateStoreConfiguration.class})
@EnableAutoConfiguration
public class BankingTestConfiguration {

View File

@@ -2,12 +2,12 @@ package net.chrisrichardson.eventstore.javaexamples.banking.backend;
import io.eventuate.EntityWithIdAndVersion;
import io.eventuate.EventuateAggregateStore;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts.Account;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts.AccountService;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.transactions.MoneyTransfer;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.transactions.MoneyTransferService;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend.Account;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend.AccountService;
import net.chrisrichardson.eventstore.javaexamples.banking.common.transactions.TransferState;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.transactions.TransferDetails;
import net.chrisrichardson.eventstore.javaexamples.banking.transactionsservice.backend.MoneyTransfer;
import net.chrisrichardson.eventstore.javaexamples.banking.transactionsservice.backend.MoneyTransferService;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@@ -2,12 +2,13 @@ package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.ac
import io.eventuate.EntityWithIdAndVersion;
import io.eventuate.EventuateAggregateStore;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts.Account;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts.AccountService;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.transactions.MoneyTransfer;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.transactions.MoneyTransferService;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend.Account;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend.AccountService;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend.AccountQueryService;
import net.chrisrichardson.eventstore.javaexamples.banking.common.transactions.TransferState;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.transactions.TransferDetails;
import net.chrisrichardson.eventstore.javaexamples.banking.transactionsservice.backend.MoneyTransfer;
import net.chrisrichardson.eventstore.javaexamples.banking.transactionsservice.backend.MoneyTransferService;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@@ -1,15 +1,16 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.accounts;
import io.eventuate.javaclient.spring.jdbc.EventuateJdbcEventStoreConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts.AccountConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.transactions.MoneyTransferConfiguration;
import io.eventuate.javaclient.spring.jdbc.EmbeddedTestAggregateStoreConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend.AccountsBackendConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.accountsviewservice.backend.AccountViewBackendConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.transactionsservice.backend.MoneyTransferBackendConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
@Import({AccountConfiguration.class, MoneyTransferConfiguration.class, EventuateJdbcEventStoreConfiguration.class,
QuerySideAccountConfiguration.class})
@Import({AccountsBackendConfiguration.class, MoneyTransferBackendConfiguration.class, EmbeddedTestAggregateStoreConfiguration.class,
AccountViewBackendConfiguration.class})
@EnableAutoConfiguration
public class AccountQuerySideTestConfiguration {
}

View File

@@ -2,9 +2,10 @@ package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.cu
import io.eventuate.EntityWithIdAndVersion;
import io.eventuate.EventuateAggregateStore;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers.Customer;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers.CustomerService;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerInfo;
import net.chrisrichardson.eventstore.javaexamples.banking.customersservice.backend.Customer;
import net.chrisrichardson.eventstore.javaexamples.banking.customersservice.backend.CustomerService;
import net.chrisrichardson.eventstore.javaexamples.banking.customersviewservice.backend.CustomerQueryService;
import net.chrisrichardson.eventstore.javaexamples.banking.web.customers.queryside.common.QuerySideCustomer;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.ToAccountInfo;
import net.chrisrichardson.eventstorestore.javaexamples.testutil.Producer;

View File

@@ -1,14 +1,14 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.customers;
import io.eventuate.javaclient.spring.jdbc.EventuateJdbcEventStoreConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers.CustomerConfiguration;
import io.eventuate.javaclient.spring.jdbc.EmbeddedTestAggregateStoreConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.customersservice.backend.CustomerBackendConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.customersviewservice.backend.CustomerViewBackendConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
@Import({CustomerConfiguration.class, EventuateJdbcEventStoreConfiguration.class, QuerySideCustomerConfiguration.class})
@Import({CustomerBackendConfiguration.class, EmbeddedTestAggregateStoreConfiguration.class, CustomerViewBackendConfiguration.class})
@EnableAutoConfiguration
public class CustomerQuerySideTestConfiguration {
}

View File

@@ -3,6 +3,6 @@ package net.chrisrichardson.eventstore.javaexamples.banking.backend.common.accou
import io.eventuate.Event;
import io.eventuate.EventEntity;
@EventEntity(entity="net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts.Account")
@EventEntity(entity="net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend.Account")
public abstract class AccountEvent implements Event{
}

View File

@@ -7,6 +7,6 @@ import io.eventuate.EventEntity;
/**
* Created by Main on 11.02.2016.
*/
@EventEntity(entity = "net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers.Customer")
@EventEntity(entity = "net.chrisrichardson.eventstore.javaexamples.banking.customersservice.backend.Customer")
public abstract class CustomerEvent implements Event {
}

View File

@@ -3,6 +3,6 @@ package net.chrisrichardson.eventstore.javaexamples.banking.backend.common.trans
import io.eventuate.Event;
import io.eventuate.EventEntity;
@EventEntity(entity="net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.transactions.MoneyTransfer")
@EventEntity(entity="net.chrisrichardson.eventstore.javaexamples.banking.transactionsservice.backend.MoneyTransfer")
public abstract class MoneyTransferEvent implements Event {
}

View File

@@ -1,12 +0,0 @@
apply plugin: 'java'
dependencies {
compile project(":common")
compile project(":common-backend")
compile "io.eventuate.client.java:eventuate-client-java-spring:$eventuateClientVersion"
testCompile project(":testutil")
testCompile "junit:junit:4.11"
testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion"
}

View File

@@ -1,6 +0,0 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers;
import io.eventuate.Command;
interface CustomerCommand extends Command {
}

View File

@@ -1,4 +0,0 @@
FROM java:openjdk-8u91-jdk
CMD java ${JAVA_OPTS} -jar customers-command-side-service.jar
EXPOSE 8080
COPY build/libs/customers-command-side-service.jar .

View File

@@ -1,25 +0,0 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web;
import io.eventuate.javaclient.spring.httpstomp.EventuateHttpStompClientConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.commonswagger.CommonSwaggerConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.web.commandside.customers.CustomersCommandSideWebConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
@Configuration
@Import({CustomersCommandSideWebConfiguration.class, EventuateHttpStompClientConfiguration.class, CommonSwaggerConfiguration.class})
@EnableAutoConfiguration
public class CustomersCommandSideServiceConfiguration {
@Bean
public HttpMessageConverters customConverters() {
HttpMessageConverter<?> additional = new MappingJackson2HttpMessageConverter();
return new HttpMessageConverters(additional);
}
}

View File

@@ -1,11 +0,0 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web.main;
import net.chrisrichardson.eventstore.javaexamples.banking.web.CustomersCommandSideServiceConfiguration;
import org.springframework.boot.SpringApplication;
public class CustomersCommandSideServiceMain {
public static void main(String[] args) {
SpringApplication.run(CustomersCommandSideServiceConfiguration.class, args);
}
}

View File

@@ -1,11 +0,0 @@
apply plugin: 'java'
dependencies {
compile project(":common")
compile project(":customers-command-side-backend")
compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion"
}

View File

@@ -1,14 +0,0 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web.commandside.customers;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers.CustomerConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
@Import({CustomerConfiguration.class})
@ComponentScan
public class CustomersCommandSideWebConfiguration extends WebMvcConfigurerAdapter {
}

View File

@@ -1,4 +0,0 @@
FROM java:openjdk-8u91-jdk
CMD java ${JAVA_OPTS} -jar customers-query-side-service.jar
EXPOSE 8080
COPY build/libs/customers-query-side-service.jar .

View File

@@ -1,26 +0,0 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web;
import io.eventuate.javaclient.spring.httpstomp.EventuateHttpStompClientConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.commonswagger.CommonSwaggerConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.web.customers.queryside.CustomersQuerySideWebConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
@Configuration
@Import({CustomersQuerySideWebConfiguration.class, EventuateHttpStompClientConfiguration.class, CommonSwaggerConfiguration.class})
@EnableAutoConfiguration
public class CustomersQuerySideServiceConfiguration {
@Bean
public HttpMessageConverters customConverters() {
HttpMessageConverter<?> additional = new MappingJackson2HttpMessageConverter();
return new HttpMessageConverters(additional);
}
}

View File

@@ -1,11 +0,0 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web.main;
import net.chrisrichardson.eventstore.javaexamples.banking.web.CustomersQuerySideServiceConfiguration;
import org.springframework.boot.SpringApplication;
public class CustomersQuerySideServiceMain {
public static void main(String[] args) {
SpringApplication.run(CustomersQuerySideServiceConfiguration.class, args);
}
}

View File

@@ -1,8 +0,0 @@
apply plugin: 'java'
dependencies {
compile project(":customers-query-side-backend")
compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"
}

View File

@@ -1,13 +0,0 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web.customers.queryside;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.customers.QuerySideCustomerConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
@Import({QuerySideCustomerConfiguration.class})
@ComponentScan
public class CustomersQuerySideWebConfiguration extends WebMvcConfigurerAdapter {
}

View File

@@ -0,0 +1,4 @@
FROM java:openjdk-8u91-jdk
CMD java ${JAVA_OPTS} -jar customers-service.jar
EXPOSE 8080
COPY build/libs/customers-service.jar .

View File

@@ -5,13 +5,15 @@ apply plugin: 'spring-boot'
apply plugin: EventuateDependencyPlugin
dependencies {
compile project(":customers-command-side-web")
compile project(":common")
compile project(":common-backend")
compile project(":common-swagger")
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.springframework.boot:spring-boot-starter-actuator"
testCompile project(":testutil")
testCompile "org.springframework.boot:spring-boot-starter-test"
testCompile "junit:junit:4.11"
testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion"
}

View File

@@ -0,0 +1,23 @@
package net.chrisrichardson.eventstore.javaexamples.banking.customersservice;
import io.eventuate.javaclient.driver.EventuateDriverConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.commonswagger.CommonSwaggerConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.customersservice.web.CustomersWebConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
@Configuration
@Import({CustomersWebConfiguration.class, EventuateDriverConfiguration.class, CommonSwaggerConfiguration.class})
@EnableAutoConfiguration
public class CustomersServiceMain {
public static void main(String[] args) {
SpringApplication.run(CustomersServiceMain.class, args);
}
}

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers;
package net.chrisrichardson.eventstore.javaexamples.banking.customersservice.backend;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.ToAccountInfo;

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers;
package net.chrisrichardson.eventstore.javaexamples.banking.customersservice.backend;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerInfo;

View File

@@ -1,11 +1,11 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers;
package net.chrisrichardson.eventstore.javaexamples.banking.customersservice.backend;
import io.eventuate.Event;
import io.eventuate.EventUtil;
import io.eventuate.ReflectiveMutableCommandProcessingAggregate;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.customers.CustomerToAccountDeleted;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.customers.CustomerAddedToAccount;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.customers.CustomerCreatedEvent;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.customers.CustomerToAccountDeleted;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerInfo;
import java.util.List;

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers;
package net.chrisrichardson.eventstore.javaexamples.banking.customersservice.backend;
import io.eventuate.AggregateRepository;
import io.eventuate.EventuateAggregateStore;
@@ -10,7 +10,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@EnableEventHandlers
@ComponentScan
public class CustomerConfiguration {
public class CustomerBackendConfiguration {
@Bean
public CustomerService customerService(AggregateRepository<Customer, CustomerCommand> customerRepository) {

View File

@@ -0,0 +1,6 @@
package net.chrisrichardson.eventstore.javaexamples.banking.customersservice.backend;
import io.eventuate.Command;
interface CustomerCommand extends Command {
}

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers;
package net.chrisrichardson.eventstore.javaexamples.banking.customersservice.backend;
import io.eventuate.AggregateRepository;

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers;
package net.chrisrichardson.eventstore.javaexamples.banking.customersservice.backend;
public class DeleteToAccountCommand implements CustomerCommand {

View File

@@ -1,12 +1,11 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web.commandside.customers;
package net.chrisrichardson.eventstore.javaexamples.banking.customersservice.web;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers.CustomerService;
import net.chrisrichardson.eventstore.javaexamples.banking.common.accounts.CreateAccountResponse;
import net.chrisrichardson.eventstore.javaexamples.banking.common.accounts.DeleteAccountResponse;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.AddToAccountResponse;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerInfo;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerResponse;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.ToAccountInfo;
import net.chrisrichardson.eventstore.javaexamples.banking.customersservice.backend.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

View File

@@ -0,0 +1,24 @@
package net.chrisrichardson.eventstore.javaexamples.banking.customersservice.web;
import net.chrisrichardson.eventstore.javaexamples.banking.customersservice.backend.CustomerBackendConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
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.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
@Import({CustomerBackendConfiguration.class})
@ComponentScan
public class CustomersWebConfiguration extends WebMvcConfigurerAdapter {
@Bean
public HttpMessageConverters customConverters() {
HttpMessageConverter<?> additional = new MappingJackson2HttpMessageConverter();
return new HttpMessageConverters(additional);
}
}

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web;
package net.chrisrichardson.eventstore.javaexamples.banking.customersservice;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerInfo;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerResponse;

View File

@@ -1,9 +1,8 @@
package net.chrisrichardson.eventstore.javaexamples.banking.web;
package net.chrisrichardson.eventstore.javaexamples.banking.customersservice;
import io.eventuate.javaclient.spring.jdbc.EventuateJdbcEventStoreConfiguration;
import io.eventuate.javaclient.spring.jdbc.EmbeddedTestAggregateStoreConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.commonauth.AuthConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.commonswagger.CommonSwaggerConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.web.commandside.customers.CustomersCommandSideWebConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.customersservice.web.CustomersWebConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
@@ -17,7 +16,9 @@ import java.util.Arrays;
import java.util.List;
@Configuration
@Import({CustomersCommandSideWebConfiguration.class, EventuateJdbcEventStoreConfiguration.class, CommonSwaggerConfiguration.class, AuthConfiguration.class})
@Import({CustomersWebConfiguration.class,
EmbeddedTestAggregateStoreConfiguration.class,
AuthConfiguration.class})
@EnableAutoConfiguration
public class CustomersCommandSideServiceTestConfiguration {

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers;
package net.chrisrichardson.eventstore.javaexamples.banking.customersservice.backend;
import net.chrisrichardson.eventstorestore.javaexamples.testutil.AbstractEntityEventTest;

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers;
package net.chrisrichardson.eventstore.javaexamples.banking.customersservice.backend;
import io.eventuate.Event;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.customers.CustomerCreatedEvent;

View File

@@ -0,0 +1,4 @@
FROM java:openjdk-8u91-jdk
CMD java ${JAVA_OPTS} -jar customers-view-service.jar
EXPOSE 8080
COPY build/libs/customers-view-service.jar .

View File

@@ -1,10 +1,16 @@
apply plugin: 'java'
apply plugin: VerifyMongoDBConfigurationPlugin
apply plugin: VerifyEventStoreEnvironmentPlugin
apply plugin: EventuateDependencyPlugin
apply plugin: 'spring-boot'
dependencies {
compile project(":common-backend")
compile project(":customers-query-side-common")
compile project(":common-swagger")
compile "io.eventuate.client.java:eventuate-client-java-spring:$eventuateClientVersion"
compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"
compile "org.springframework.boot:spring-boot-starter-data-mongodb:$springBootVersion"
compile 'com.fasterxml.jackson.core:jackson-core:2.4.3'
@@ -12,8 +18,13 @@ dependencies {
compile 'com.fasterxml.jackson.module:jackson-module-scala_2.10:2.4.3'
testCompile project(":testutil")
testCompile project(":customers-service")
testCompile "junit:junit:4.11"
testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
testCompile "org.springframework.boot:spring-boot-starter-test"
testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion"
}
test {
ignoreFailures System.getenv("EVENTUATE_API_KEY_ID") == null
}

View File

@@ -0,0 +1,25 @@
package net.chrisrichardson.eventstore.javaexamples.banking.customersviewservice;
import io.eventuate.javaclient.driver.EventuateDriverConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.commonswagger.CommonSwaggerConfiguration;
import net.chrisrichardson.eventstore.javaexamples.banking.customersviewservice.web.CustomersViewWebConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
@Configuration
@Import({CustomersViewWebConfiguration.class,
EventuateDriverConfiguration.class,
CommonSwaggerConfiguration.class})
@EnableAutoConfiguration
public class CustomersViewServiceMain {
public static void main(String[] args) {
SpringApplication.run(CustomersViewServiceMain.class, args);
}
}

View File

@@ -1,8 +1,8 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.customers;
package net.chrisrichardson.eventstore.javaexamples.banking.customersviewservice.backend;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.CustomerInfo;
import net.chrisrichardson.eventstore.javaexamples.banking.web.customers.queryside.common.QuerySideCustomer;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.ToAccountInfo;
import net.chrisrichardson.eventstore.javaexamples.banking.web.customers.queryside.common.QuerySideCustomer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DuplicateKeyException;
@@ -21,10 +21,10 @@ public class CustomerInfoUpdateService {
private Logger logger = LoggerFactory.getLogger(getClass());
private QuerySideCustomerRepository querySideCustomerRepository;
private CustomerViewRepository querySideCustomerRepository;
private MongoTemplate mongoTemplate;
public CustomerInfoUpdateService(QuerySideCustomerRepository querySideCustomerRepository, MongoTemplate mongoTemplate) {
public CustomerInfoUpdateService(CustomerViewRepository querySideCustomerRepository, MongoTemplate mongoTemplate) {
this.querySideCustomerRepository = querySideCustomerRepository;
this.mongoTemplate = mongoTemplate;
}

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.customers;
package net.chrisrichardson.eventstore.javaexamples.banking.customersviewservice.backend;
import io.eventuate.CompletableFutureUtil;
import net.chrisrichardson.eventstore.javaexamples.banking.web.customers.queryside.common.QuerySideCustomer;
@@ -9,9 +9,9 @@ import java.util.concurrent.CompletableFuture;
public class CustomerQueryService {
private QuerySideCustomerRepository querySideCustomerRepository;
private CustomerViewRepository querySideCustomerRepository;
public CustomerQueryService(QuerySideCustomerRepository querySideCustomerRepository) {
public CustomerQueryService(CustomerViewRepository querySideCustomerRepository) {
this.querySideCustomerRepository = querySideCustomerRepository;
}

View File

@@ -1,12 +1,12 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.customers;
package net.chrisrichardson.eventstore.javaexamples.banking.customersviewservice.backend;
import io.eventuate.DispatchedEvent;
import io.eventuate.EventHandlerMethod;
import io.eventuate.EventSubscriber;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.accounts.AccountDeletedEvent;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.customers.CustomerToAccountDeleted;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.customers.CustomerAddedToAccount;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.customers.CustomerCreatedEvent;
import net.chrisrichardson.eventstore.javaexamples.banking.backend.common.customers.CustomerToAccountDeleted;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.ToAccountInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@@ -1,4 +1,4 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.customers;
package net.chrisrichardson.eventstore.javaexamples.banking.customersviewservice.backend;
import io.eventuate.javaclient.spring.EnableEventHandlers;
import org.springframework.context.annotation.Bean;
@@ -14,26 +14,26 @@ import org.springframework.data.mongodb.repository.config.EnableMongoRepositorie
@EnableMongoRepositories
@EnableEventHandlers
@ComponentScan
public class QuerySideCustomerConfiguration {
public class CustomerViewBackendConfiguration {
@Bean
public CustomerQueryWorkflow customerQueryWorkflow(CustomerInfoUpdateService accountInfoUpdateService) {
return new CustomerQueryWorkflow(accountInfoUpdateService);
}
@Bean
public CustomerInfoUpdateService customerInfoUpdateService(QuerySideCustomerRepository querySideCustomerRepository, MongoTemplate mongoTemplate) {
public CustomerInfoUpdateService customerInfoUpdateService(CustomerViewRepository querySideCustomerRepository, MongoTemplate mongoTemplate) {
return new CustomerInfoUpdateService(querySideCustomerRepository, mongoTemplate);
}
@Bean
public CustomerQueryService customerQueryService(QuerySideCustomerRepository accountInfoRepository) {
public CustomerQueryService customerQueryService(CustomerViewRepository accountInfoRepository) {
return new CustomerQueryService(accountInfoRepository);
}
@Bean
public QuerySideDependencyChecker querysideDependencyChecker(MongoTemplate mongoTemplate) {
return new QuerySideDependencyChecker(mongoTemplate);
public ViewDependencyChecker querysideDependencyChecker(MongoTemplate mongoTemplate) {
return new ViewDependencyChecker(mongoTemplate);
}
}

View File

@@ -1,11 +1,11 @@
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.customers;
package net.chrisrichardson.eventstore.javaexamples.banking.customersviewservice.backend;
import net.chrisrichardson.eventstore.javaexamples.banking.web.customers.queryside.common.QuerySideCustomer;
import org.springframework.data.mongodb.repository.MongoRepository;
import java.util.List;
interface QuerySideCustomerRepository extends MongoRepository<QuerySideCustomer, String> {
interface CustomerViewRepository extends MongoRepository<QuerySideCustomer, String> {
List<QuerySideCustomer> findByEmailLike(String email);
}

Some files were not shown because too many files have changed in this diff Show More