package Ġno . nav . kl age . clients Ċ Ċ import Ġorg . springframework . http . HttpStatus Ċ import Ġorg . springframework . web . reactive . function . client . ClientResponse Ċ import Ġorg . springframework . web . reactive . function . client . Exchange Function Ċ import Ġorg . springframework . web . reactive . function . client . Web Client Ċ import Ġreactor . core . publisher . Mono Ċ Ċ fun Ġcreate Short Circuit Web Client ( json Response : ĠString ): ĠWeb Client Ġ{ ĊĠĠĠ Ġval Ġclient Response : ĠClient Response Ġ= ĠClient Response ĊĠĠĠĠĠĠĠ Ġ. create ( HttpStatus . OK ) ĊĠĠĠĠĠĠĠ Ġ. header (" Content - Type "," application / json ") ĊĠĠĠĠĠĠĠ Ġ. body ( json Response ). build () ĊĊĠĠĠ Ġval Ġshort Circuit ing Exchange Function Ġ= ĠExchange Function Ġ{ ĊĠĠĠĠĠĠĠ ĠMono . just ( client Response ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġreturn ĠWeb Client . builder (). exchange Function ( short Circuit ing Exchange Function ). build () Ċ } Ċ Ċ @ Experimental Std lib Api Ċ fun Ġcreate Short Circuit Web Client Queued ( var arg Ġjson Responses : ĠString ): ĠWeb Client Ġ{ ĊĠĠĠ Ġval Ġresponse List Ġ= ĠArray Deque ( json Responses . map Ġ{ ĊĠĠĠĠĠĠĠ ĠClient Response ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. create ( HttpStatus . OK ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. header (" Content - Type "," application / json ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. body ( it ). build () ĊĠĠĠ Ġ}) ĊĊĠĠĠ Ġval Ġshort Circuit ing Exchange Function Ġ= ĠExchange Function Ġ{ ĊĠĠĠĠĠĠĠ ĠMono . just ( response List . remove First ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġreturn ĠWeb Client . builder (). exchange Function ( short Circuit ing Exchange Function ). build () Ċ } Ċ Ċ fun Ġcreate Fail ing Web Client (): ĠWeb Client Ġ{ ĊĠĠĠ Ġval Ġclient Response : ĠClient Response Ġ= ĠClient Response ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. create ( HttpStatus . INTERNAL _ SERVER _ ERROR ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠ Ġval Ġexchange Function Ġ= ĠExchange Function Ġ{ ĊĠĠĠĠĠĠĠ ĠMono . just ( client Response ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġreturn ĠWeb Client . builder (). exchange Function ( exchange Function ). build () Ċ } Ċ