-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
2,066 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
coverage: | ||
status: | ||
project: | ||
default: | ||
target: 80% # the required coverage value | ||
patch: | ||
default: | ||
target: 80% # the required coverage value |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
### create bank account | ||
PUT http://localhost:8088/bankaccount?owner=Heinz | ||
|
||
> {% | ||
client.global.set("bankAccountId", response.body.trim()); | ||
%} | ||
|
||
### get current balance | ||
GET http://localhost:8088/bankaccount/{{bankAccountId}}/balance | ||
Content-Type: application/json | ||
|
||
### get current owner | ||
GET http://localhost:8088/bankaccount/{{bankAccountId}}/owner | ||
Content-Type: application/json | ||
|
||
### deposit money | ||
POST http://localhost:8088/bankaccount/{{bankAccountId}}/deposit?euroInCent=1000 | ||
|
||
### withdraw money | ||
POST http://localhost:8088/bankaccount/{{bankAccountId}}/withdraw?euroInCent=500 | ||
|
||
### change owner | ||
POST http://localhost:8088/bankaccount/{{bankAccountId}}/change-owner?newOwner=Harald |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.holixon.axon</groupId> | ||
<artifactId>axon-adhoc-projection-examples-root</artifactId> | ||
<version>0.1.0</version> | ||
</parent> | ||
|
||
<artifactId>axon-adhoc-projection-examples-banking-java</artifactId> | ||
<description>Java example</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.holixon.axon</groupId> | ||
<artifactId>axon-adhoc-projection-spring</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
|
||
<!-- Spring boot --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<!-- Axon --> | ||
<dependency> | ||
<groupId>org.axonframework</groupId> | ||
<artifactId>axon-modelling</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.axonframework</groupId> | ||
<artifactId>axon-messaging</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.axonframework</groupId> | ||
<artifactId>axon-eventsourcing</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.axonframework</groupId> | ||
<artifactId>axon-spring-boot-starter</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.datatype</groupId> | ||
<artifactId>jackson-datatype-jsr310</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-actuator</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
12 changes: 12 additions & 0 deletions
12
...g-java/src/main/java/io/holixon/axon/projection/adhoc/example/JavaBankingApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package io.holixon.axon.projection.adhoc.example; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class JavaBankingApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(JavaBankingApplication.class, args); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...rc/main/java/io/holixon/axon/projection/adhoc/example/events/BankAccountCreatedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package io.holixon.axon.projection.adhoc.example.events; | ||
|
||
import java.util.UUID; | ||
|
||
public record BankAccountCreatedEvent( | ||
String bankAccountId, | ||
String owner | ||
) { | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
...va/src/main/java/io/holixon/axon/projection/adhoc/example/events/MoneyDepositedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package io.holixon.axon.projection.adhoc.example.events; | ||
|
||
import java.util.UUID; | ||
|
||
public record MoneyDepositedEvent( | ||
String bankAccountId, | ||
int euroInCent) { | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
...va/src/main/java/io/holixon/axon/projection/adhoc/example/events/MoneyWithdrawnEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package io.holixon.axon.projection.adhoc.example.events; | ||
|
||
import java.util.UUID; | ||
|
||
public record MoneyWithdrawnEvent( | ||
String bankAccountId, | ||
int euroInCent) { | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
...java/src/main/java/io/holixon/axon/projection/adhoc/example/events/OwnerChangedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package io.holixon.axon.projection.adhoc.example.events; | ||
|
||
import java.util.UUID; | ||
|
||
public record OwnerChangedEvent( | ||
String bankAccountId, | ||
String newOwner) { | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
...ava/src/main/java/io/holixon/axon/projection/adhoc/example/model/CurrentBalanceModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.holixon.axon.projection.adhoc.example.model; | ||
|
||
import io.holixon.axon.projection.adhoc.example.events.BankAccountCreatedEvent; | ||
import io.holixon.axon.projection.adhoc.example.events.MoneyDepositedEvent; | ||
import io.holixon.axon.projection.adhoc.example.events.MoneyWithdrawnEvent; | ||
import org.axonframework.messaging.annotation.MessageHandler; | ||
|
||
public record CurrentBalanceModel( | ||
String bankAccountId, | ||
int currentBalanceInEuroCent | ||
) { | ||
|
||
@MessageHandler | ||
public CurrentBalanceModel(BankAccountCreatedEvent event) { | ||
this(event.bankAccountId(), 0); | ||
} | ||
|
||
@MessageHandler | ||
public CurrentBalanceModel on(MoneyDepositedEvent event) { | ||
return new CurrentBalanceModel(bankAccountId, this.currentBalanceInEuroCent + event.euroInCent()); | ||
} | ||
|
||
@MessageHandler | ||
public CurrentBalanceModel on(MoneyWithdrawnEvent event) { | ||
return new CurrentBalanceModel(bankAccountId, this.currentBalanceInEuroCent - event.euroInCent()); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...rc/main/java/io/holixon/axon/projection/adhoc/example/model/CurrentBalanceRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.holixon.axon.projection.adhoc.example.model; | ||
|
||
import io.holixon.axon.projection.adhoc.ModelRepository; | ||
import io.holixon.axon.projection.adhoc.ModelRepositoryConfig; | ||
import org.axonframework.eventsourcing.eventstore.EventStore; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class CurrentBalanceRepository extends ModelRepository<CurrentBalanceModel> { | ||
public CurrentBalanceRepository(EventStore eventStore) { | ||
super(eventStore, CurrentBalanceModel.class, new ModelRepositoryConfig()); | ||
} | ||
} |
Oops, something went wrong.