Initial projections in continuous schedule
Closed this issue · 0 comments
bounoable commented
A complex continuous projection job may creates a projection target that needs all of the past events in order to fully build the projection state. Currently, when a continuous projection schedule triggers, only the events that triggered the schedule in that moment are applied "continuously" to the projections. A projection must be able to hint to the projection job that it needs the full event history for the initial run.
package example
type Foo struct {
valid bool
}
func (f *Foo) ApplyEvent(e event.Event) {
switch e.Name {
case "initialized":
f.valid = true
case "changed":
if !f.valid {
panic("not allowed")
}
}
}
func (f *Foo) RequiresFullHistory() bool {
return !f.valid
}