0
RxJava中是否有任何对象,除ConnectableObservable<>
之外允许在Observable上拥有多个订阅?例如一个特定的主题?一个可观察到的两个观察者
E.g.下面给定的主题:
private PublishSubject<Location> locationSubject = PublishSubject.create();
我需要有多个订阅:
locationSubject
.{several filtering, throttling functions here}
.subscribe(a -> doSomething(a));
locationSubject
.{several other filtering, throttling functions here}
.subscribe(a -> doSomethingElse(a));
因此,在上述情况下,第二订阅将覆盖第一个。谁可以保持订阅活着?
'PublishSubject'允许多个订阅。你为什么认为第二次订阅会覆盖第一次? –
@VladimirMironov你是对的。问题在我的代码中的其他地方。他们工作正常 – Diolor