How to use custom class as Observable and fire method in time interval

Viewed 3506

I have a class Producer, simplifying it has method public Object readData() I want to make this class as Observable (RxJava).

How to indicate which method should be called? Do I need transform my Producer class into Future or Iterable?

The next problem is that the readData should be call every n seconds. Some methods, for instance from, has scheduler parameter but I can not find any example how to apply it. I found interval method, but it emits a sequence of integers. So far, without Observable I use Executors.newSingleThreadScheduledExecutor().scheduleWithFixedDelay(....)

2 Answers
Related