The problem we are seeing is that a particular event is being ignored by our EventSourcing handler but not by our Projector. This causes the projections to be in a different state from the aggregate. The weird thing is that we have many events with the same signature which are NOT being ignored.
Aggregate: this sourcingHandler updates the field ‘state’ in the aggregate, and it is never reached when a particular old event is applied. What we do know is that the Projectors do handle them.
@EventSourcingHandler
public void accepted(TaskAccepted event) {
state = event.getState();
}
The EventHandler in the projector:
@EventHandler
fun on(event: TaskAccepted, replayStatus: ReplayStatus) {
updateTaskState(event.taskId, event.state, event.created)
}
What we have noticed with our logs and an interceptor is that the event is applied but never reaches our Task aggregate. This occurs with an event that is a few months old, but newer events of the same type work fine and are not ignored by the aggregate. We also know that the event’s signature has not changed since then.
The Task aggregate is defined as an AggregateMember of the class Bulletin:
@AggregateMember(routingKey = "taskId", eventForwardingMode = ForwardMatchingInstancesFake::class)
val tasks = mutableListOf<Task>()
We have tinkered with the class ForwardMatchingInstances to print some logs. From these logs we were able to determine that there never seems to be a payload for the events mentioned, which means they were never even considered for ‘Forwarding’.
We are extremely puzzled.