package Ġnet . lic c ioni . backend Ċ Ċ import Ġorg . apache . logging . log 4 j . Log Manager Ċ import Ġorg . apache . logging . log 4 j . Logger Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . cloud . stream . function . Stream Bridge Ċ import Ġorg . springframework . data . rest . core . annotation . Handle After Create Ċ import Ġorg . springframework . data . rest . core . annotation . Handle Before Create Ċ import Ġorg . springframework . data . rest . core . annotation . Repository EventHandler Ċ import Ġorg . springframework . integration . support . Message Builder Ċ import Ġorg . springframework . stereotype . Component Ċ Ċ @ Component Ċ @ Repository EventHandler Ċ class ĠBase Entity EventHandler ( private Ġval Ġid Generator : ĠId Generator ) Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġlogger : ĠLogger Ġ= ĠLog Manager . getLogger ( Base Entity EventHandler :: class . java ) ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġstream Bridge Provider : ĠStream Bridge ĊĊĠĠĠ Ġ@ Handle Before Create ĊĠĠĠ Ġfun Ġhandle Before Create ( party : ĠParty ) Ġ{ ĊĠĠĠĠĠĠĠ Ġparty . identifier Ġ= Ġid Generator . generate () ĊĠĠĠĠĠĠĠ Ġlogger . info (" Before Create : Ġ${ party . java Class . simple Name } Ġwith Ġid : Ġ${ party . identifier }") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Handle After Create ĊĠĠĠ Ġfun Ġhandle After Create ( party : ĠParty ) Ġ{ ĊĠĠĠĠĠĠĠ Ġlogger . info (" After Create : Ġ${ party . java Class . simple Name } Ġwith Ġid : Ġ${ party . identifier }") ĊĠĠĠĠĠĠĠ Ġstream Bridge Provider . send (" persons - event - output ", ĠMessage Builder . with Payload ( party ). build ()) ĊĠĠĠ Ġ} Ċ }