Hello there
We would like to implement our own event processors and replay events on them.
Therefore we have implemented the replay by the following code:
@Component
class Replay(
private val eventProcessingConfiguration: EventProcessingConfiguration
) {
fun replay(name: String = "none") : String {
if (name == "none") return "An replay processing Group must be defined."
this.eventProcessingConfiguration.eventProcessor(name, TrackingEventProcessor::class.java).ifPresent {
it.shutDown()
it.resetTokens()
it.start()
}
return "Replay done."
}
}
@RestController
class ReplayController(private val replay: Replay) {
@PostMapping("/replay/{group}")
fun doReplay(@PathVariable group: String) : ResponseEntity<*> {
return ResponseEntity.ok(this.replay.replay(group))
}
}
Event Processors are added by annotation on event handlinc components.
@ProcessingGroup("qualification")
open class Qualification protected constructor() {
@AggregateIdentifier
private lateinit var uuid: UUID
companion object {
fun create(uuid: UUID, title: String) : Qualification {
val qualification = Qualification()
AggregateLifecycle.apply(QualificationCreated(uuid, title))
return qualification
}
}
@EventSourcingHandler
fun on(event: QualificationCreated) {
this.uuid = event.uuid
}
}
@Component
@ProcessingGroup("qualification")
interface QualificationProjection : Repository<QualificationDetails, String> {
@EventHandler
@Modifying
@Transactional
@Query("INSERT INTO Qualification (uuid, title) VALUES (:#{#qualificationCreated.uuid}, :#{#qualificationCreated.title})")
fun write(qualificationCreated: QualificationCreated)
}
Our Problem is, that the replay does not have any effect. I have noticed, that the tables “tokenStore” and other (exept from domainevententry and snapshotevententry) are not generated by default. I had implemented them by myself, but this had no effect as well.
Have I missed any configuration/spring beans?