Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory watch - added, changed, deleted files as events #35

Closed
johanandren opened this issue Aug 4, 2016 · 2 comments
Closed

Directory watch - added, changed, deleted files as events #35

johanandren opened this issue Aug 4, 2016 · 2 comments
Assignees
Milestone

Comments

@johanandren
Copy link
Member

Idea for a new source, I have one lying around on my computer since earlier and there was discussions on akka/akka about such a source.

I'm thinking Source[(Path, ChangeType), SomeWayToCancel] or possibly skip that SomeWayToCancel since it can be achieved by combining with a KillSwitch

@johanandren johanandren self-assigned this Aug 4, 2016
@joearasin
Copy link

It's a bit of a hack, but to play around with other pieces of the system and punt the innards of this to later, I used:

  val monitor = RxMonitor()
  val observable: Observable[EventAtPath] = monitor.observable
  val publisher = RxReactiveStreams.toPublisher(JavaConversions.toJavaObservable(observable))
  val eventSource: Source[EventAtPath, NotUsed] = Source.fromPublisher(publisher)
  // Run things 
  monitor.registerPath(ENTRY_MODIFY, "/path/to/whatever")

using https://github.com/lloydmeta/schwatcher with RxReactiveStreams

@johanandren
Copy link
Member Author

We also discussed pulling in https://github.com/pathikrit/better-files and use their actor based watch. But I think I'll stick to using the JDK provided WatchService (https://docs.oracle.com/javase/8/docs/api/java/nio/file/FileSystem.html#newWatchService--). It's a pretty horrible interface, but it's 0-dependencies so that is a nice thing. It should be using native OS facilities on some platforms AFAIR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants