Use sdk/hvves-producer in hvves/xnf-simulator
[dcaegen2/collectors/hv-ves.git] / sources / hv-collector-utils / src / main / kotlin / org / onap / dcae / collectors / veshv / utils / arrow / effects.kt
index 290ef72..5682522 100644 (file)
@@ -23,11 +23,10 @@ import arrow.core.Either
 import arrow.core.Left
 import arrow.core.Right
 import arrow.effects.IO
-import arrow.effects.fix
-import arrow.effects.instances.io.monadError.monadError
-import arrow.typeclasses.binding
+import org.reactivestreams.Publisher
 import reactor.core.publisher.Flux
 import reactor.core.publisher.Mono
+import reactor.core.publisher.toMono
 import kotlin.system.exitProcess
 
 /**
@@ -62,6 +61,9 @@ fun <T> Mono<T>.asIo() = IO.async<T> { callback ->
     })
 }
 
+fun <T> Publisher<T>.then(callback: () -> Unit): Mono<Unit> =
+        toMono().then(Mono.fromCallable(callback))
+
 fun <T> Flux<IO<T>>.evaluateIo(): Flux<T> =
         flatMap { io ->
             io.attempt().unsafeRunSync().fold(