Compare commits

..

No commits in common. "371c4fa5aa7de64681ffd871c9d3ceef31ac3e46" and "652355f48684b79038508e6ff0a33dccffcab992" have entirely different histories.

6 changed files with 13 additions and 15 deletions

View File

@ -16,14 +16,14 @@ import java.math.BigDecimal
import java.util.UUID
@Aggregate
class BankAccountAggregate() {
class BankAccountAggregate(
@AggregateIdentifier
private var id: UUID? = null
private var balance: BigDecimal? = null
private var id: UUID? = null,
private var balance: BigDecimal? = null,
private var owner: String? = null
) {
@CommandHandler
constructor(command: CreateAccountCommand) : this() {
constructor(command: CreateAccountCommand) {
AggregateLifecycle.apply(
AccountCreatedEvent(
command.accountId,

View File

@ -4,6 +4,8 @@ import java.io.Serializable
import java.math.BigDecimal
import java.util.UUID
import javax.persistence.Entity
import javax.persistence.GeneratedValue
import javax.persistence.GenerationType
import javax.persistence.Id
import javax.persistence.Table
@ -11,6 +13,7 @@ import javax.persistence.Table
@Table(name = "bank_accounts")
data class BankAccount(
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
var id: UUID? = null,
var owner: String? = null,

View File

@ -62,6 +62,6 @@ class BankAccountProjection @Autowired constructor(
@QueryHandler
fun handle(query: FindBankAccountQuery): BankAccount? {
log.debug("Handling FindBankAccountQuery query: {}", query)
return this.bankAccountRepository.findById(query.id).orElse(null)
return this.bankAccountRepository.findById(query.accountId).orElse(null)
}
}

View File

@ -3,5 +3,5 @@ package com.cubetiqs.demo.axon.query
import java.util.UUID
data class FindBankAccountQuery(
val id: UUID
val accountId: UUID
)

View File

@ -44,4 +44,6 @@ class AccountCommandServiceImpl @Autowired constructor(
)
)
}
}

View File

@ -2,8 +2,6 @@ server:
port: 8182
spring:
application:
name: axon-demo
datasource:
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://${POSTGRES_HOST:192.168.0.202}:${POSTGRES_PORT:5432}/${POSTGRES_DB:axon_demo}
@ -36,8 +34,3 @@ spring:
axon:
serializer:
general: jackson
axonserver:
servers: 192.168.0.202
logging:
level.root: debug