我用几个嵌套的observable和两个Zip
运算符创建了这个长的observable。
我的问题是,最外面的Zip
运算符永远不会调用它的函数...在这种情况下它是Func5(...)
。
我可以调试嵌套的Zip
运算符并看到Func6(...)
返回Map<String, Object>
但是没有任何反应。 onNext
中没有onError
,onComplete
或subscriber
。
我在这里缺少什么?
Zip
运算符返回一个observable,所以我假设嵌套没问题。
Observable.zip(
UserApi.doThis(someValue)
.flatMap(new Func1<String, Observable<typeA1>>() {
@Override
public Observable<typeA1> call(String photoId) {
return UserApi.getUserPhotoData(photoId);
}
}),
UserApi.doThat(),
UserApi.doSomething(settingName0),
InstitutionApi.getThis(someValue),
Observable.zip(
InstitutionApi.getInstitutionSetting(settingName1).onErrorReturn(new Func1<Throwable, typeB1>() {
@Override
public typeB1 call(Throwable throwable) {
return new typeB1(...);
}
}),
InstitutionApi.getInstitutionSetting(settingName2).onErrorReturn(new Func1<Throwable, typeB1>() {
@Override
public typeB1 call(Throwable throwable) {
return new typeB1(...);
}
}),
InstitutionApi.getInstitutionSetting(settingName3).onErrorReturn(new Func1<Throwable, typeB1>() {
@Override
public typeB1 call(Throwable throwable) {
return new typeB1(...);
}
}),
InstitutionApi.getInstitutionContentString(stringName1).onErrorReturn(new Func1<Throwable, typeB2>() {
@Override
public typeB2 call(Throwable throwable) {
return null;
}
}),
InstitutionApi.getInstitutionSetting(settingName4).onErrorReturn(new Func1<Throwable, typeB1>() {
@Override
public typeB1 call(Throwable throwable) {
return new typeB1(...);
}
}),
InstitutionApi.getInstitutionSetting(settingName5).onErrorReturn(new Func1<Throwable, typeB1>() {
@Override
public typeB1 call(Throwable throwable) {
return new typeB1(...);
}
}),
new Func6<typeB1, typeB1, typeB1, typeB2, typeB1, typeB1, Map<String, Object>>() {
@Override
public Map<String, Object> call(typeB1 r0, typeB1 r1, typeB1 r2,
typeB2 r3, typeB1 r4, typeB1 r5) {
Map<String, Object> map = new HashMap<>();
try {
// do things
} catch (Exception e) {
return null;
}
return map;
}
}),
new Func5<typeA1, typeA2, typeA3, typeA4, Map<String, Object>, EndReturnType>() {
@Override
public EndReturnType call(typeA1 r0, typeA2 r1, typeA3 r2, typeA4 r3, Map<String, Object> r4) {
EndReturnType ert = new EndReturnType ();
// do things
return ert;
}
});
答案 0 :(得分:1)
正如评论中提到的zsxwing,由于缺少{{1}}函数,我的一个函数没有返回值。