package Ġbr . com . edu ard os ou za . application A . events . listeners Ċ Ċ import Ġbr . com . edu ard os ou za . application A . config . Events Configuration Properties Ċ import Ġcom . google . cloud . spring . data . datastore . core . mapping . event . After Save Event Ċ import Ġcom . google . cloud . spring . pubsub . core . Pub Sub Template Ċ import Ġorg . slf 4 j . LoggerFactory Ċ import Ġorg . springframework . context . Application Listener Ċ import Ġorg . springframework . stereotype . Component Ċ Ċ @ Component Ċ class ĠAdd Company EventListener ( ĊĠĠĠ Ġprivate Ġval Ġpub Sub Template : ĠPub Sub Template , ĊĠĠĠ Ġprivate Ġval Ġproperties : ĠEvents Configuration Properties Ċ ) Ġ: ĠApplication Listener < After Save Event >{ ĊĊĠĠĠ Ġoverride Ġfun Ġon Application Event ( event : ĠAfter Save Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsource Ġ= Ġevent . source ĊĊĠĠĠĠĠĠĠ Ġlogger . info (" Entity Ġadded : Ġ$ source ") ĊĊĠĠĠĠĠĠĠ Ġpub Sub Template . publish ( properties . company . pubsub . topic , Ġsource , Ġcreate Attributes ()) ĊĊĠĠĠĠĠĠĠ Ġlogger . info (" Message Ġpublished .") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġcreate Attributes () Ġ= ĊĠĠĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" deleted ", Ġ" false "), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" clock ", ĠSystem . currentTimeMillis (). toString ()) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġlogger Ġ= ĠLoggerFactory . getLogger ( Add Company EventListener :: class . java ) ĊĠĠĠ Ġ} Ċ Ċ }