mirror of
https://github.com/corda/corda.git
synced 2025-02-22 10:10:59 +00:00
client: reactfx->rx
This commit is contained in:
parent
86d6ee0110
commit
a2ace973ff
@ -9,10 +9,10 @@ import com.r3corda.core.random63BitValue
|
|||||||
import com.r3corda.core.serialization.deserialize
|
import com.r3corda.core.serialization.deserialize
|
||||||
import com.r3corda.core.serialization.serialize
|
import com.r3corda.core.serialization.serialize
|
||||||
import com.r3corda.node.services.monitor.*
|
import com.r3corda.node.services.monitor.*
|
||||||
import org.reactfx.EventSink
|
|
||||||
import org.reactfx.EventStream
|
|
||||||
import org.slf4j.Logger
|
import org.slf4j.Logger
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
import rx.Observable
|
||||||
|
import rx.Observer
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Worked example of a client which communicates with the wallet monitor service.
|
* Worked example of a client which communicates with the wallet monitor service.
|
||||||
@ -23,8 +23,8 @@ private val log: Logger = LoggerFactory.getLogger("WalletMonitorClient")
|
|||||||
class WalletMonitorClient(
|
class WalletMonitorClient(
|
||||||
val net: MessagingService,
|
val net: MessagingService,
|
||||||
val node: NodeInfo,
|
val node: NodeInfo,
|
||||||
val outEvents: EventStream<ClientToServiceCommand>,
|
val outEvents: Observable<ClientToServiceCommand>,
|
||||||
val inEvents: EventSink<ServiceToClientEvent>
|
val inEvents: Observer<ServiceToClientEvent>
|
||||||
) {
|
) {
|
||||||
private val sessionID = random63BitValue()
|
private val sessionID = random63BitValue()
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ class WalletMonitorClient(
|
|||||||
|
|
||||||
net.addMessageHandler(WalletMonitorService.IN_EVENT_TOPIC, sessionID) { msg, reg ->
|
net.addMessageHandler(WalletMonitorService.IN_EVENT_TOPIC, sessionID) { msg, reg ->
|
||||||
val event = msg.data.deserialize<ServiceToClientEvent>()
|
val event = msg.data.deserialize<ServiceToClientEvent>()
|
||||||
inEvents.push(event)
|
inEvents.onNext(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
val req = RegisterRequest(net.myAddress, sessionID)
|
val req = RegisterRequest(net.myAddress, sessionID)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user