I am learning Axon, and seem to be making good progress. I created my application following the Bike Rental example. However, I am not sure as to the section of code that replays/applies previous events to my plain POJO and gives me the current state.
@EventHandler
public void on(BookReturnedEvnt event) {
this.bookInforRepository
.findById(event.getId())
.map(bk -> {
bk.setStatus(event.isStatus());
return bk;
});
}
@QueryHandler(queryName = "findOne")
public BookInfo findOne(String id){
return this.bookInforRepository.findById(id).orElse(null);
}