Last active
August 29, 2015 14:22
-
-
Save nsk-mironov/087bbe570a617d366260 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final Observable<MyDatum> observable = Observable.interval(10, TimeUnit.SECONDS).flatMap(new Func1<Long, Observable<MyDatum>>() { | |
@Override | |
public Observable<MyDatum> call(final Long counter) { | |
return db.select("SELECT f1,f2 FROM mydata") | |
.autoMap(MyDatum.class) | |
.doOnNext(new Action1<MyDatum>() { | |
@Override | |
public void call(final MyDatum value) { | |
state.add(value); | |
} | |
}) | |
.doOnCompleted(new Action0() { | |
@Override | |
public void call() { | |
state.makeAvailable(); | |
} | |
}); | |
} | |
}); | |
final Subscription subscription = observable.subscribe(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment