diff options
author | Jakub Dudycz <jakub.dudycz@nokia.com> | 2019-02-19 18:06:33 +0100 |
---|---|---|
committer | Jakub Dudycz <jakub.dudycz@nokia.com> | 2019-02-21 12:54:54 +0100 |
commit | bacba429e2dd6b3048da7e75800f5ad200952599 (patch) | |
tree | f62d89972415e8e8da51fd042b980048efea0ecd /sources/hv-collector-utils/src/main | |
parent | 82b27ff5bccc925fe03d05f259cf881fafc8a1ce (diff) |
Use sdk/hvves-producer in hvves/xnf-simulator
Change-Id: I8f493b0edd2cbaef136a22d914ad24198bb63a7f
Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com>
Issue-ID: DCAEGEN2-1253
Diffstat (limited to 'sources/hv-collector-utils/src/main')
-rw-r--r-- | sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/arrow/effects.kt | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/arrow/effects.kt b/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/arrow/effects.kt index 290ef72c..56825221 100644 --- a/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/arrow/effects.kt +++ b/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/arrow/effects.kt @@ -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( |