package Ġcom . j ah nel group . elasticsearch . integration Ċ Ċ import Ġcom . j ah nel group . elasticsearch . data . person . Person Ċ import Ġcom . j ah nel group . elasticsearch . data . person . elastic . Elastic Person Ċ import Ġcom . j ah nel group . elasticsearch . data . person . elastic . Person Search Repo Ċ import Ġorg . springframework . beans . Bean Utils Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . context . annotation . Bean Ċ import Ġorg . springframework . context . annotation . Configuration Ċ import Ġorg . springframework . data . rest . core . event . After Create Event Ċ import Ġorg . springframework . integration . dsl . Integration Flow Ċ import Ġorg . springframework . integration . dsl . Integration Flows Ċ import Ġorg . springframework . integration . event . inbound . Application Event Listening Message Producer Ċ Ċ @ Configuration Ċ open Ġclass ĠIntegration { ĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġlateinit Ġvar Ġperson Search Repo : ĠPerson Search Repo ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġopen Ġfun Ġcreate (): ĠApplication Event Listening Message Producer Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġproducer Ġ= ĠApplication Event Listening Message Producer () ĊĠĠĠĠĠĠĠ Ġproducer . set Event Types ( After Create Event :: class . java ) ĊĠĠĠĠĠĠĠ Ġreturn Ġproducer ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġopen Ġfun Ġcreate Flow (): ĠIntegration Flow Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠIntegration Flows . from ( create ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. filter { after Create Event : ĠAfter Create Event Ġ-> Ġafter Create Event . source Ġis ĠPerson } ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. log () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. handle Ġ{ Ġpayload : ĠAfter Create Event , Ġ_ Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġelastic Person Ġ= ĠElastic Person () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠBean Utils . copy Properties ( payload . source Ġas ĠPerson , Ġelastic Person ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprintln ( person Search Repo . save ( elastic Person )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. get () ĊĊĠĠĠ Ġ} ĊĊ Ċ } Ċ