package Ġuk . gov . just ice . digital . h mp ps . pr isoner search . services . health Ċ Ċ import Ġorg . springframework . boot . act uate . health . Health Ċ import Ġorg . springframework . boot . act uate . health . Health Indicator Ċ import Ġorg . springframework . web . reactive . function . client . Web Client Ċ import Ġorg . springframework . web . reactive . function . client . Web ClientResponse Exception Ċ import Ġreactor . core . publisher . Mono Ċ import Ġjava . time . Duration Ċ Ċ abstract Ġclass ĠHealth Check ( ĊĠ Ġprivate Ġval Ġweb Client : ĠWeb Client , ĊĠ Ġprivate Ġval Ġbase Uri : ĠString , ĊĠ Ġprivate Ġval Ġtimeout : ĠDuration Ċ ) Ġ: ĠHealth Indicator Ġ{ ĊĊĠ Ġoverride Ġfun Ġhealth (): ĠHealth ? Ġ{ ĊĠĠĠ Ġreturn Ġweb Client . get () ĊĠĠĠĠĠ Ġ. uri ("$ base Uri / health / ping ") ĊĠĠĠĠĠ Ġ. retrieve () ĊĠĠĠĠĠ Ġ. to Entity ( String :: class . java ) ĊĠĠĠĠĠ Ġ. flatMap Ġ{ ĠMono . just ( Health . up (). with Detail (" HttpStatus ", Ġit ?. statusCode ). build ()) Ġ} ĊĠĠĠĠĠ Ġ. onError Resume ( Web ClientResponse Exception :: class . java ) Ġ{ ĠMono . just ( Health . down ( it ). with Detail (" body ", Ġit . response Body AsString ). with Detail (" HttpStatus ", Ġit . statusCode ). build ()) Ġ} ĊĠĠĠĠĠ Ġ. onError Resume ( Exception :: class . java ) Ġ{ ĠMono . just ( Health . down ( it ). build ()) Ġ} ĊĠĠĠĠĠ Ġ. block ( timeout ) ĊĠ Ġ} Ċ } Ċ