package Ġcom . r 3 . demo . dat ad ist ribution . flows Ċ Ċ import Ġco . parallel universe . fib ers . Suspend able Ċ import Ġnet . cord a . core . contracts . Contract State Ċ import Ġnet . cord a . core . contracts . State And Ref Ċ import Ġnet . cord a . core . flows .* Ċ import Ġnet . cord a . core . identity . Party Ċ import Ġnet . cord a . core . node . States To Record Ċ import Ġnet . cord a . core . transactions . Signed Transaction ĊĊ Ċ object ĠData Broad Cast Flows Ġ{ ĊĊĠĠĠ Ġ// Ġreference : Ġhttps :// l ank yd an . dev / broadcast ing - a - transaction - to - external - organ isations ĊĠĠĠ Ġ@ Start able By Service ĊĠĠĠ Ġ@ Initi ating Flow ĊĠĠĠ Ġclass ĠTransaction Broadcast Init iator Flow ( ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġsigned Transaction : ĠSigned Transaction , ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġcounter Party : ĠParty ĊĠĠĠ Ġ) Ġ: ĠFlow Logic < Unit >() Ġ{ ĊĊĠĠĠĠĠĠĠ Ġ@ Suspend able ĊĠĠĠĠĠĠĠ Ġoverride Ġfun Ġcall () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġflow Session Ġ= Ġinitiate Flow ( counter Party ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsub Flow ( Send Transaction Flow ( flow Session , Ġsigned Transaction )) Ċ // ĠĠĠĠĠĠĠĠĠĠĠ Ġsub Flow ( Send State And Ref Flow ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġ@ Initi ated By ( Transaction Broadcast Init iator Flow :: class ) ĊĠĠĠ Ġclass ĠTransaction Broadcast Responder Flow ( private Ġval Ġsession : ĠFlow Session ) Ġ: ĠFlow Logic < Unit >() Ġ{ ĊĊĠĠĠĠĠĠĠ Ġ@ Suspend able ĊĠĠĠĠĠĠĠ Ġoverride Ġfun Ġcall () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsub Flow ( Receive Transaction Flow ( session , Ġstates To Record Ġ= ĠStates To Record . ALL _ VISIBLE )) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠTODO Ġadd Ġlogic Ġif Ġwe Ġare Ġent itled Ġto Ġdistribute Ġthen Ġdistribute ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġ@ Start able By Service ĊĠĠĠ Ġ@ Initi ating Flow ĊĠĠĠ Ġclass ĠState And Ref Broadcast Init iator Flow ( ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġstate And Refs : ĠSet < State And Ref < Contract State >>, ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġcounter Party : ĠParty ĊĠĠĠ Ġ) Ġ: ĠFlow Logic < Unit >() Ġ{ ĊĊĠĠĠĠĠĠĠ Ġ@ Suspend able ĊĠĠĠĠĠĠĠ Ġoverride Ġfun Ġcall () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġflow Session Ġ= Ġinitiate Flow ( counter Party ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsub Flow ( Send State And Ref Flow ( flow Session , Ġstate And Refs . toList ())) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġ@ Initi ated By ( State And Ref Broadcast Init iator Flow :: class ) ĊĠĠĠ Ġclass ĠState And Ref Broadcast Responder Flow ( private Ġval Ġsession : ĠFlow Session ) Ġ: ĠFlow Logic < Unit >() Ġ{ ĊĊĠĠĠĠĠĠĠ Ġ@ Suspend able ĊĠĠĠĠĠĠĠ Ġoverride Ġfun Ġcall () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsub Flow ( Receive State And Ref Flow < Contract State >( session )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠTODO Ġadd Ġlogic Ġif Ġwe Ġare Ġent itled Ġto Ġdistribute Ġthen Ġdistribute ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ Ċ } ĊĊĊ