rx java - How do I re-start my observer if onError is called for my subscription? -


i using:

publishsubject<pubnubobserverdata> = publishsubject.create() 

i wondering how can restart subscription when

onerror(throwable e)  

is called by?

currently subscription stops when there error.

you can use retry() operator automatically re-subscribe immediately. alternatively, can use retrywhen() operator resubscribe after delay or conditionally.

observable   .retrywhen( error -> error.flatmap( e -> observable.timer(1, seconds)) 

will retry subscription after 1 second. using flatmap() test kind of error , retry on particular error.

observable   .retrywhen( error -> error.flatmap( e -> {      if (e instanceof ioexception) {return observable.timer(1, seconds);}       return observable.just( e );     } ) 

will retry if error ioexception , not other type of error.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -