I am a student and still very new to Axon. I have been trying to get the event AxonServerEventScheduler to work for a project of mine but continue to get very strange behavior. I am using Spring + Kotlin, I have events axon starter dependency. Currently connected to a postgresql db and axon server in docker containers.
All my EventHandlers and EventSourcingHandlers worked great when called through the aggregatelifecycle / event bus and then I tried to schedule an event and I received a stack trace and now my EventHandlers are not being called however my EventSourcingHandlers do work within the aggregate. So far I have tried a few things but the only way to get my events to run again is to shut down the Axon Server docker container, delete the events / data folders, recreate them then turn AxonServer back on which seems to me that events are being corrupted. I had an error/ stack trace before and I fixed it by manually creating the token_entry table. Is there another table I need for the Event Scheduler to work? Here is my configuration and code. If you need the repo link let me know. Due to the limits on new users I can only upload 1 picture.
Configuration:
@ Bean
fun eventScheduler(connectionManager: AxonServerConnectionManager):
AxonServerEventScheduler {
return AxonServerEventScheduler.builder()
.connectionManager(connectionManager)
.build()
}
Token:
val token = eventScheduler.schedule(Duration.ofMillis(2000),
CreateContractEvent(
contractId = UUID.randomUUID().toString()
))
Configuration & Only configuration other than event bus:
fun eventScheduler(connectionManager: AxonServerConnectionManager): AxonServerEventScheduler {
return AxonServerEventScheduler.builder()
.connectionManager(connectionManager)
.build()
}
Handler:
@ Component
class TestEventHandler {
@ EventHandler
fun handle(createContractEvent: CreateContractEvent) {
print("\ninside Event Handler")
}
}