package Ġcom . x quare . v 1 users ervice . user . handler Ċ Ċ import Ġcom . x quare . v 1 users ervice . user . event . user create . Authority Created Failed Event Ċ import Ġcom . x quare . v 1 users ervice . user . router . User Event Router Ċ import Ġcom . x quare . v 1 users ervice . user . save user . api . Create User In Pending State Re vert Ċ import Ġjava . util . UUID Ċ import Ġorg . springframework . stereotype . Component Ċ Ċ @ Component Ċ class ĠUser Exception EventHandler ( ĊĠĠĠ Ġprivate Ġval Ġcreate User In Pending State Re vert : ĠCreate User In Pending State Re vert Ċ ) Ġ{ ĊĊĠĠĠ Ġsuspend Ġfun Ġexception Handler ( ĊĠĠĠĠĠĠĠ Ġauthority Created Failed Event : ĠAuthor ity Created Failed Event , ĊĠĠĠĠĠĠĠ Ġtopic : ĠString ĊĠĠĠ Ġ) Ġ{ ĊĠĠĠĠĠĠĠ Ġwhen Ġ( topic . remove Prefix To Get Pure ErrorType ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" authority - creation " Ġ-> Ġrevert User Creation ( authority Created Failed Event . userId ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun ĠString . remove Prefix To Get Pure ErrorType () Ġ= ĊĠĠĠĠĠĠĠ Ġthis . replace ( User Event Router . USER _ ERROR _ TOPIC _ PREFIX , Ġ"") ĊĊĠĠĠ Ġprivate Ġsuspend Ġfun Ġrevert User Creation ( userId : ĠUUID ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcreate User In Pending State Re vert . revert Step ( userId ) ĊĠĠĠ Ġ} Ċ } Ċ