package Ġcom . lab ij ie . infra . commons . sink . spring . conf Ċ Ċ import Ġcom . lab ij ie . infra . commons . sink . conf . Kafka Settings Ċ import Ġcom . lab ij ie . infra . commons . sink . sink . Sink Base Ċ import Ġcom . lab ij ie . infra . commons . sink . spring . Elastic Search Client Ċ import Ġcom . lab ij ie . infra . sink . elastic . conf . Elastic Search Config Ċ import Ġorg . elasticsearch . common . settings . Settings Ċ import Ġorg . elasticsearch . common . transport . Transport Address Ċ import Ġorg . elasticsearch . transport . client . Pre Built Transport Client Ċ import Ġorg . springframework . boot . autoconfigure . condition . Conditional On Class Ċ import Ġorg . springframework . boot . autoconfigure . condition . Conditional On Missing Bean Ċ import Ġorg . springframework . boot . context . properties . Configuration Properties Ċ import Ġorg . springframework . context . annotation . Bean Ċ import Ġorg . springframework . context . annotation . Configuration Ċ import Ġorg . springframework . context . annotation . Primary Ċ import Ġjava . net . Inet SocketAddress Ċ Ċ /** Ċ Ġ* Ċ Ġ* Ġ@ author Ġl ish iw en Ċ Ġ* Ġ@ date Ġ 1 8 - 8 - 1 6 Ċ Ġ* Ġ@ since ĠJDK 1 . 8 Ċ Ġ*/ Ċ @ Configuration ( proxy Bean Methods Ġ= Ġfalse ) Ċ @ Conditional On Class ( Sink Base :: class ) Ċ class ĠElastic Json Auto Configuration Ġ{ ĊĊĠ Ġ@ Bean ĊĠ Ġ@ Primary ĊĠ Ġ@ Configuration Properties (" infra . kafka ") ĊĠ Ġfun Ġkafka Settings (): ĠKafka Settings Ġ= ĠKafka Settings () ĊĊĠ Ġ@ Bean ĊĠ Ġ@ Primary ĊĠ Ġ@ Configuration Properties (" infra . elasticsearch ") ĊĠ Ġfun Ġelastic Config (): ĠElastic Search Config Ġ= ĠElastic Search Config () ĊĊĠ Ġ@ Bean ĊĠ Ġ@ Conditional On Missing Bean ĊĠ Ġfun Ġes Client ( elastic Config : ĠElastic Search Config ): ĠElastic Search Client Ġ{ ĊĠĠĠ Ġval Ġkey Ġ= Ġelastic Config . getKey () ĊĠĠĠ Ġval Ġsettings Ġ= ĠSettings . builder () ĊĠĠĠĠĠĠĠ Ġ. put (" client . transport . sn iff ", Ġtrue ) ĊĠĠĠĠĠĠĠ Ġ. put (" client . transport . ping _ timeout ", Ġ"${ elastic Config . client Ping Timeout } s ") ĊĠĠĠĠĠĠĠ Ġ. put (" client . transport . nodes _ sampler _ interval ", Ġ"${ elastic Config . client Node Interval } s ") ĊĠĠĠĠĠĠĠ Ġ. put (" cluster . name ", Ġkey . cluster Name ) ĊĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠ Ġif Ġ(! elastic Config . set Net ty Processors ) ĊĠĠĠĠĠ ĠSystem . setProperty (" es . set . netty . runtime . available . processors ", Ġ" false ") ĊĠĠĠ Ġval Ġtransport Client Ġ= ĠPre Built Transport Client ( settings ) ĊĠĠĠĠĠĠĠ Ġ. apply Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġkey . servers . trim (). split ("," ). forEach Ġ{ Ġserver Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġhost And Port Ġ= Ġserver . trim (). split (": ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Transport Address ( Transport Address ( Inet SocketAddress ( host And Port [ 0 ]. trim (), Ġhost And Port [ 1 ]. trim (). toInt ()))) ĊĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġreturn ĠElastic Search Client ( ĊĠĠĠĠĠĠĠ Ġtransport Ġ= Ġtransport Client ĊĠĠĠ Ġ) ĊĠ Ġ} Ċ }