4

I'm trying to reactively tail a log file using RxJava-File:

    File file = new File(".\\server.log");
    Observable<String> newLines =
            FileObservable.tailer()
                    .file(file)
                    .startPosition(file.length())
                    .sampleTimeMs(1000)
                    .chunkSize(8192)
                    .utf8()
                    .tailText();

    newLines.subscribe(System.out::println);

and it works as expected. But as soon as I try to chain some more operators, I get problems. For instance, changing to

  newLines.filter(LogfileWatcher::error).subscribe(System.out::println);

(where error() is a simple function String -> Boolean) I get output only after the first append to the file, but not the subsequent ones. Similar problems appear when using window() or several other operators.

What am I doing wrong?

kenshin
  • 197
  • 11
  • 2
    interesting, I'll have a look. rxjava-file was an early creation of mine, might be time to review it a bit. – Dave Moten Sep 18 '15 at 10:04

1 Answers1

4

Backpressure support had to be fixed in rxjava-file and your test case is reported to be working as of rxjava-file 0.3.3 on Maven Central.

Dave Moten
  • 11,957
  • 2
  • 40
  • 47