I have a code block may like this.
fun main() {
foo()
.flatMap {
bar()
}
.subscribe({}, {
main()
},{
main()
})
}
fun foo(): Observable<Int> {
// has some real business which take times here
return Observable.just(1)
}
fun bar(): Observable<Int> {
// has some real business which take times here
return Observable.just(2)
}
Which will repeat after onComplete or onError.
But I think the style above is not good! Is any good way to this in RxJava itself?
retry()
andrepeat()
? – akarnokdrepeat
... – user3875388