Hi!
I faced with the issue and I need advice.
I have :
@Aggregate
class UpdatePermission() {
@AggregateIdentifier
private var id: AxxalonIdentifier? = null
@CommandHandler
fun updatePermission(command: UpdatePermissionCommand) {
var a = AggregateLifecycle.apply(PermissionUpdateEvent(command.id, command.title))
}
@CommandHandler
constructor(command: CreatePermissionCommand) : this() {
var a = AggregateLifecycle.apply(PermissionCreatedEvent(command.id, command.title))
}
@EventSourcingHandler(payloadType = PermissionCreatedEvent::class)
fun on(event: PermissionCreatedEvent) {
this.id = event.id
}
}
Steps for reproduce the exception:
- Start server with application
- Send ‘Create’ event
- Restart server with application
- Send ‘Update’ event
Question is: How I can init field which annotated AggregateIdentifier after restart server ? Can I do it at method ‘updatePermission’ ?