hyperledger-iroha / iroha-java

https://wiki.hyperledger.org/display/iroha
28 stars 38 forks source link

[LAOS] Add coroutine wrapper for `Iroha2Client` as reactive stream publisher #365

Open appetrosyan opened 1 year ago

appetrosyan commented 1 year ago

A suggestion arose to add a wrapper of the couroutines in jp.co.soramitsu.iroha2.Iroha2Client into the reactor and/or reactive stream publisher (whichever is easier, with preference for the publisher).


fun subscribeToBlocks(from: Long, count: Int): Flux<VersionedBlockMessage> {
    return subscribeToBlockStream(from, count).asFlux()
}

fun subscribeToBlocksAsPublisher(from: Long, count: Int): Publisher<VersionedBlockMessage> {
    return subscribeToBlockStream(from, count).asPublisher();
}
Mingela commented 1 year ago

This should be done on a client side, we wouldn't want to bring massive framework dependencies into an SDK since it's up to a client to decide, we rely only on built-in mechanisms and lightweight libraries