数据读取
通道与订阅
当前版本 · 1.4.0
latest() 返回可空快照,next() 返回单次异步结果。publisher() 是热流:没有需求时丢弃样本,后续请求不回放。订阅配置只影响新订阅,不改变快照或单次读取。
ReadChannel
com.qnbot.sdk.channel.ReadChannel
ReadChannel.withConfig
ReadChannel<T> withConfig(SubscriptionConfig config)
ReadChannel.latest
Optional<Sample<T>> latest()
ReadChannel.subscribe
Subscription subscribe(Consumer<Sample<T>> callback)
ReadChannel.publisher
Flow.Publisher<Sample<T>> publisher()
ReadChannel.next
CompletionStage<Sample<T>> next()
StateChannel
com.qnbot.sdk.channel.StateChannel
StateChannel.withConfig
StateChannel<T> withConfig(SubscriptionConfig config)
StateChannel.set
void set(T value)
StateChannel.clear
void clear()
Sample
com.qnbot.sdk.channel.Sample
| 字段 / 枚举值 |
|---|
final T value |
final long sequence |
final Double sourceTime |
final double observedAt |
Subscription
com.qnbot.sdk.channel.Subscription
Subscription.unsubscribe
void unsubscribe()