订阅者不会从Flowable接收任何数据。 onNext()和onError()都不会被调用。但当org.reactivestreams.Subscriber被io.reactivex.functions.Consumer取代时 工作得很完美。
repository.getAgentInfo()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new org.reactivestreams.Subscriber<AgentInfo>() {
@Override
public void onSubscribe(Subscription s) {
Log.d("onSubscribe()", s.toString());
}
@Override
public void onNext(AgentInfo agentInfo) {
Log.d("onNext()", agentInfo.toString());
}
@Override
public void onError(Throwable t) {
Log.d("onError()", t.getLocalizedMessage());
}
@Override
public void onComplete() {
Log.d("onComplete()", "");
}
});
@Dao
public interface FeedbackDao {
@Query("SELECT * FROM PartnerInfoEntity LIMIT 1")
Flowable<AgentInfoInfoEntity> getAgentInfo();
@Insert(onConflict = OnConflictStrategy.REPLACE)
void inserntAgentInfo(AgentInfoInfoEntity agentInfoEntity);
}
请向我解释为什么它不能与订阅者一起使用