Simplified project structure
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts;
|
||||
|
||||
|
||||
import io.eventuate.Command;
|
||||
|
||||
interface AccountCommand extends Command {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.accounts;
|
||||
|
||||
public class DeleteAccountCommand implements AccountCommand {
|
||||
}
|
||||
@@ -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 .
|
||||
@@ -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
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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 .
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
}
|
||||
4
java-spring/accounts-service/Dockerfile
Normal file
4
java-spring/accounts-service/Dockerfile
Normal 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 .
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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> {
|
||||
@@ -0,0 +1,7 @@
|
||||
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend;
|
||||
|
||||
|
||||
import io.eventuate.Command;
|
||||
|
||||
interface AccountCommand extends Command {
|
||||
}
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
@@ -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() {
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package net.chrisrichardson.eventstore.javaexamples.banking.accountsservice.backend;
|
||||
|
||||
public class DeleteAccountCommand implements AccountCommand {
|
||||
}
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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 {
|
||||
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
4
java-spring/accounts-view-service/Dockerfile
Normal file
4
java-spring/accounts-view-service/Dockerfile
Normal 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 .
|
||||
@@ -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
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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.*;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
@@ -36,7 +34,7 @@ public class AccountQueryWorkflow {
|
||||
AccountOpenedEvent event = de.getEvent();
|
||||
String id = de.getEntityId();
|
||||
Int128 eventId = de.getEventId();
|
||||
logger.info("**************** account version=" + id + ", " + eventId);
|
||||
logger.info("**************** account version={}, {}", id, eventId);
|
||||
BigDecimal initialBalance = event.getInitialBalance();
|
||||
|
||||
String customerId = event.getCustomerId();
|
||||
@@ -58,8 +56,8 @@ public class AccountQueryWorkflow {
|
||||
String moneyTransferId = de.getEntityId();
|
||||
String fromAccountId = de.getEvent().getDetails().getFromAccountId();
|
||||
String toAccountId = de.getEvent().getDetails().getToAccountId();
|
||||
logger.info("**************** account version=" + fromAccountId + ", " + eventId);
|
||||
logger.info("**************** account version=" + toAccountId + ", " + eventId);
|
||||
logger.info("**************** account version={}, {}", fromAccountId, eventId);
|
||||
logger.info("**************** account version={}, {}", toAccountId, eventId);
|
||||
|
||||
AccountTransactionInfo ti = new AccountTransactionInfo(moneyTransferId,
|
||||
fromAccountId,
|
||||
@@ -120,7 +118,7 @@ public class AccountQueryWorkflow {
|
||||
long balanceDelta = amount * delta;
|
||||
AccountChangeInfo ci = new AccountChangeInfo(changeId, transactionId, de.getEvent().getClass().getSimpleName(), amount, balanceDelta);
|
||||
String accountId = de.getEntityId();
|
||||
logger.info("**************** account version=" + accountId + ", " + de.getEventId().asString());
|
||||
logger.info("**************** account version={}, {}", accountId, de.getEventId().asString());
|
||||
|
||||
accountInfoUpdateService.updateBalance(accountId, changeId, balanceDelta, ci);
|
||||
}
|
||||
@@ -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) {
|
||||
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
@@ -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() {
|
||||
}
|
||||
@@ -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() {
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
@@ -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
|
||||
@@ -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"
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
|
||||
@@ -66,13 +66,16 @@ public class AuthConfiguration extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.csrf().disable()
|
||||
.httpBasic().and()
|
||||
http
|
||||
.csrf()
|
||||
.disable()
|
||||
.httpBasic()
|
||||
.and()
|
||||
.authorizeRequests()
|
||||
.antMatchers("/index.html", "/", "/**.js", "/**.css").permitAll()
|
||||
.antMatchers("/swagger-ui.html", "/v2/api-docs").permitAll()
|
||||
.antMatchers(HttpMethod.POST, "/api/customers", "/api/login").permitAll()
|
||||
.anyRequest().authenticated().and()
|
||||
.antMatchers(HttpMethod.POST, "/api/customers", "/api/login").permitAll()
|
||||
.antMatchers("/api/**").permitAll()
|
||||
.anyRequest().permitAll()
|
||||
.and()
|
||||
.addFilterAfter(new StatelessAuthenticationFilter(tokenAuthenticationService), BasicAuthenticationFilter.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -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{
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
@@ -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 {
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package net.chrisrichardson.eventstore.javaexamples.banking.backend.commandside.customers;
|
||||
|
||||
import io.eventuate.Command;
|
||||
|
||||
interface CustomerCommand extends Command {
|
||||
}
|
||||
@@ -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 .
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
@@ -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 .
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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 {
|
||||
}
|
||||
4
java-spring/customers-service/Dockerfile
Normal file
4
java-spring/customers-service/Dockerfile
Normal 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 .
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
@@ -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) {
|
||||
@@ -0,0 +1,6 @@
|
||||
package net.chrisrichardson.eventstore.javaexamples.banking.customersservice.backend;
|
||||
|
||||
import io.eventuate.Command;
|
||||
|
||||
interface CustomerCommand extends Command {
|
||||
}
|
||||
@@ -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;
|
||||
@@ -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 {
|
||||
|
||||
@@ -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.*;
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
4
java-spring/customers-view-service/Dockerfile
Normal file
4
java-spring/customers-view-service/Dockerfile
Normal 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 .
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.customers;
|
||||
package net.chrisrichardson.eventstore.javaexamples.banking.customersviewservice.backend;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
public class QuerySideDependencyChecker {
|
||||
public class ViewDependencyChecker {
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
private MongoTemplate mongoTemplate;
|
||||
|
||||
public QuerySideDependencyChecker(MongoTemplate mongoTemplate) {
|
||||
public ViewDependencyChecker(MongoTemplate mongoTemplate) {
|
||||
this.mongoTemplate = mongoTemplate;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.chrisrichardson.eventstore.javaexamples.banking.web.customers.queryside;
|
||||
package net.chrisrichardson.eventstore.javaexamples.banking.customersviewservice.web;
|
||||
|
||||
import net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.customers.CustomerQueryService;
|
||||
import net.chrisrichardson.eventstore.javaexamples.banking.customersviewservice.backend.CustomerQueryService;
|
||||
import net.chrisrichardson.eventstore.javaexamples.banking.web.customers.queryside.common.QuerySideCustomer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user