package Ġfr . ma if . autom ate . certificate Ċ Ċ import Ġarrow . core . Either Ċ import Ġfr . ma if . autom ate . certificate . event handler . Event To Command Adapter Ċ import Ġfr . ma if . autom ate . certificate . event handler . Slack EventHandler Ċ import Ġfr . ma if . autom ate . commons . L ets Autom ate Config Ċ import Ġfr . ma if . autom ate . commons . events ourcing . Postgres Event Store Ċ import Ġfr . ma if . autom ate . lets encrypt . Let S Encrypt Manager Ċ import Ġfr . ma if . autom ate . publisher . Certificate Publisher Ċ import Ġfr . ma if . autom ate . certificate . scheduler . Certificate Renew er Ċ import Ġfr . ma if . autom ate . certificate . views . All Domain View Ċ import Ġfr . ma if . autom ate . certificate . views . Events View Ċ import Ġfr . ma if . autom ate . certificate . write .* Ċ import Ġfr . ma if . autom ate . commons . Error Ċ import Ġio . reactivex . Single Ċ import Ġio . vertx . reactivex . ext . async sql . Async SQL Client Ċ import Ġio . vertx . reactivex . ext . web . client . Web Client Ċ import Ġorg . slf 4 j . Logger Ċ import Ġorg . slf 4 j . LoggerFactory Ċ Ċ class ĠC ertificates ( ĊĠĠĠĠĠĠĠ Ġlets Autom ate Config : ĠL ets Autom ate Config , ĊĠĠĠĠĠĠĠ Ġlet S Encrypt Manager : ĠLet S Encrypt Manager , ĊĠĠĠĠĠĠĠ Ġclient : ĠWeb Client , ĊĠĠĠĠĠĠĠ Ġcertificate Publisher : ĠCertificate Publisher , ĊĠĠĠĠĠĠĠ Ġpostgres Client : ĠAsync SQL Client Ċ ) Ġ{ ĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġval ĠLOGGER : ĠLogger Ġ= ĠLoggerFactory . getLogger ( Certificates :: class . java ) ĊĠĠĠ Ġ} ĊĠĠĠĠĊĠĠĠ Ġprivate Ġval Ġevent Store Ġ= ĠPostgres Event Store (" certificate _ events ", Ġ" certificate _ events _ offsets ", Ġpostgres Client ) ĊĠĠĠ Ġprivate Ġval Ġevent Reader Ġ= ĠCertificate Event Reader () ĊĠĠĠ Ġprivate Ġval Ġcertificate Event Store Ġ= ĠCertificate Event Store (" certificate ", Ġlet S Encrypt Manager , Ġcertificate Publisher , Ġevent Store , Ġevent Reader ) ĊĠĠĠ Ġprivate Ġval Ġcertificate Renew er Ġ= ĠCertificate Renew er ( lets Autom ate Config . certificates . polling Interval , Ġthis ) ĊĠĠĠ Ġprivate Ġval Ġevent To Command Adapter Ġ= ĠEvent To Command Adapter ( event Store , Ġthis , Ġ Ġevent Reader ) ĊĠĠĠ Ġprivate Ġval Ġslack EventHandler Ġ= ĠSlack EventHandler ( lets Autom ate Config . env , Ġlets Autom ate Config . slack , Ġclient , Ġevent Store , Ġevent Reader ) ĊĠĠĠ Ġval Ġall Domains View Ġ= ĠAll Domain View ( event Store , Ġevent Reader ) ĊĠĠĠ Ġval Ġevents View Ġ= ĠEvents View ( event Store , Ġevent Reader ) ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġcertificate Renew er . start Scheduler () ĊĠĠĠĠĠĠĠ Ġevent To Command Adapter . start Adapter () ĊĠĠĠĠĠĠĠ Ġslack EventHandler . start Slack Handler () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġstate (): ĠSingle < State . All Certificates > Ġ= Ġcertificate Event Store . state () ĊĊĠĠĠ Ġfun Ġon Command ( command : ĠCertificate Command ): ĠSingle < Either < Error , ĠCertificate Event >> Ġ= Ġcertificate Event Store . on Command ( command ) Ċ Ċ } Ċ