Compare commits
2 Commits
652355f486
...
371c4fa5aa
Author | SHA1 | Date | |
---|---|---|---|
371c4fa5aa | |||
559633e58a |
@ -16,14 +16,14 @@ import java.math.BigDecimal
|
|||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
@Aggregate
|
@Aggregate
|
||||||
class BankAccountAggregate(
|
class BankAccountAggregate() {
|
||||||
@AggregateIdentifier
|
@AggregateIdentifier
|
||||||
private var id: UUID? = null,
|
private var id: UUID? = null
|
||||||
private var balance: BigDecimal? = null,
|
private var balance: BigDecimal? = null
|
||||||
private var owner: String? = null
|
private var owner: String? = null
|
||||||
) {
|
|
||||||
@CommandHandler
|
@CommandHandler
|
||||||
constructor(command: CreateAccountCommand) {
|
constructor(command: CreateAccountCommand) : this() {
|
||||||
AggregateLifecycle.apply(
|
AggregateLifecycle.apply(
|
||||||
AccountCreatedEvent(
|
AccountCreatedEvent(
|
||||||
command.accountId,
|
command.accountId,
|
||||||
|
@ -4,8 +4,6 @@ import java.io.Serializable
|
|||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
import javax.persistence.Entity
|
import javax.persistence.Entity
|
||||||
import javax.persistence.GeneratedValue
|
|
||||||
import javax.persistence.GenerationType
|
|
||||||
import javax.persistence.Id
|
import javax.persistence.Id
|
||||||
import javax.persistence.Table
|
import javax.persistence.Table
|
||||||
|
|
||||||
@ -13,7 +11,6 @@ import javax.persistence.Table
|
|||||||
@Table(name = "bank_accounts")
|
@Table(name = "bank_accounts")
|
||||||
data class BankAccount(
|
data class BankAccount(
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
|
||||||
var id: UUID? = null,
|
var id: UUID? = null,
|
||||||
|
|
||||||
var owner: String? = null,
|
var owner: String? = null,
|
||||||
|
@ -62,6 +62,6 @@ class BankAccountProjection @Autowired constructor(
|
|||||||
@QueryHandler
|
@QueryHandler
|
||||||
fun handle(query: FindBankAccountQuery): BankAccount? {
|
fun handle(query: FindBankAccountQuery): BankAccount? {
|
||||||
log.debug("Handling FindBankAccountQuery query: {}", query)
|
log.debug("Handling FindBankAccountQuery query: {}", query)
|
||||||
return this.bankAccountRepository.findById(query.accountId).orElse(null)
|
return this.bankAccountRepository.findById(query.id).orElse(null)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,5 +3,5 @@ package com.cubetiqs.demo.axon.query
|
|||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
data class FindBankAccountQuery(
|
data class FindBankAccountQuery(
|
||||||
val accountId: UUID
|
val id: UUID
|
||||||
)
|
)
|
@ -44,6 +44,4 @@ class AccountCommandServiceImpl @Autowired constructor(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -2,6 +2,8 @@ server:
|
|||||||
port: 8182
|
port: 8182
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
|
application:
|
||||||
|
name: axon-demo
|
||||||
datasource:
|
datasource:
|
||||||
driverClassName: org.postgresql.Driver
|
driverClassName: org.postgresql.Driver
|
||||||
url: jdbc:postgresql://${POSTGRES_HOST:192.168.0.202}:${POSTGRES_PORT:5432}/${POSTGRES_DB:axon_demo}
|
url: jdbc:postgresql://${POSTGRES_HOST:192.168.0.202}:${POSTGRES_PORT:5432}/${POSTGRES_DB:axon_demo}
|
||||||
@ -33,4 +35,9 @@ spring:
|
|||||||
|
|
||||||
axon:
|
axon:
|
||||||
serializer:
|
serializer:
|
||||||
general: jackson
|
general: jackson
|
||||||
|
axonserver:
|
||||||
|
servers: 192.168.0.202
|
||||||
|
|
||||||
|
logging:
|
||||||
|
level.root: debug
|
Loading…
Reference in New Issue
Block a user