package Ġcom . d restaurant . query . handler Ċ Ċ import Ġcom . d restaurant . customer . domain . api . Customer Created Event Ċ import Ġcom . d restaurant . query . model . Customer Entity Ċ import Ġcom . d restaurant . query . repository . Customer Repository Ċ import Ġorg . ax on framework . config . Processing Group Ċ import Ġorg . ax on framework . event handling . Allow Replay Ċ import Ġorg . ax on framework . event handling . EventHandler Ċ import Ġorg . ax on framework . event handling . Reset Handler Ċ import Ġorg . ax on framework . event handling . SequenceNumber Ċ import Ġorg . springframework . messaging . simp . Simp Message Sending Operations Ċ import Ġorg . springframework . stereotype . Component Ċ Ċ @ Component Ċ @ Processing Group (" customer ") Ċ internal Ġclass ĠCustomer EventHandler ( private Ġval Ġrepository : ĠCustomer Repository , Ġprivate Ġval Ġmessaging Template : ĠSimp Message Sending Operations ) Ġ{ ĊĊĠĠĠ Ġ@ EventHandler ĊĠĠĠ Ġ@ Allow Replay ( true ) ĊĠĠĠ Ġfun Ġhandle ( event : ĠCustomer Created Event , Ġ@ SequenceNumber Ġaggregate Version : ĠLong ) Ġ{ ĊĠĠĠĠĠĠĠ Ġrepository . save ( Customer Entity ( event . aggregate Identifier . identifier , Ġaggregate Version , Ġevent . name . firstName , Ġevent . name . lastName , Ġevent . order Limit . amount )) ĊĠĠĠĠĠĠĠ Ġmessaging Template . convert And Send ("/ topic / customers . updates ", Ġevent ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/* ĠWill Ġbe Ġcalled Ġbefore Ġreplay / reset Ġstarts . ĠDo Ġpre - reset Ġlogic , Ġlike Ġclearing Ġout Ġthe ĠProjection Ġtable Ġ*/ ĊĠĠĠ Ġ@ Reset Handler ĊĠĠĠ Ġfun Ġon Reset () Ġ= Ġrepository . delete All () Ċ Ċ } Ċ