You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not an AKKA issue, but it is an issue that causes 1.4 (adding FileObserver/FileStream) not to work with .net core and/or on a MAC.
I ran into two issues. The first was that in order to get the file change notifications, I had to modify the SystemFileWatcher construction in FileObserver.Start() to use a filter of "*", rather than _fileNameOnly. Once I made this change, the OnFileChanged method was properly called. To verify, I changed it back and the OnFileChanged was not called. So, I changed initialization of _watcher to _watcher = new FileSystemWatcher(_fileDir, "*")
The second issue is that when the TailActor.OnReceive method properly received a FileWrite message, the FileStreamReader always returned an empty string. Even though the SystemFileWatcher was properly seeing the change to the file, the FileStreamReader was not realizing the file size had increased and therefore .ReadToEnd was returning an empty string. A hack workaround was to remember the previous file length, and then close and reopen the FileStream and FileStreamReader each time. That worked, and allowed the modified text to be picked up and properly displayed. Obviously this is not the best way of handling this, but it did allow the Tail to produce the desired output. Of course this caused problems for lesson 1.6.
Lastly, to truly provide "Tail" behavior, you may want to change the ConsoleWriterActor's Console.WriteLine(message) (in the last "else" of the OnReceive) to simply a Console.Write(message) as this allows the output to precisely echo the file input.
As I said, none of what I point out is AKKA.net related, but with the increased popularity of .net core, including developing on a MAC, having a lesson which works as expected allows the student to focus on learning AKKA, and not battling environmental differences from the bootcamp lessons that were built on the original .net framework, likely in Windows.
The text was updated successfully, but these errors were encountered:
I got this to work on my Mac without modifications, by using echo to update the file. e.g.
echo "more cowbell" >> sample_log_file.txt
this will get captured and displayed in the terminal window.
Using textedit.app does not work as it saves to a tmp file. And if you tail a file already opened by textedit, the updates do not seem to come through.
This is not an AKKA issue, but it is an issue that causes 1.4 (adding FileObserver/FileStream) not to work with .net core and/or on a MAC.
I ran into two issues. The first was that in order to get the file change notifications, I had to modify the SystemFileWatcher construction in FileObserver.Start() to use a filter of "*", rather than _fileNameOnly. Once I made this change, the OnFileChanged method was properly called. To verify, I changed it back and the OnFileChanged was not called. So, I changed initialization of _watcher to
_watcher = new FileSystemWatcher(_fileDir, "*")
The second issue is that when the TailActor.OnReceive method properly received a FileWrite message, the FileStreamReader always returned an empty string. Even though the SystemFileWatcher was properly seeing the change to the file, the FileStreamReader was not realizing the file size had increased and therefore .ReadToEnd was returning an empty string. A hack workaround was to remember the previous file length, and then close and reopen the FileStream and FileStreamReader each time. That worked, and allowed the modified text to be picked up and properly displayed. Obviously this is not the best way of handling this, but it did allow the Tail to produce the desired output. Of course this caused problems for lesson 1.6.
Lastly, to truly provide "Tail" behavior, you may want to change the ConsoleWriterActor's Console.WriteLine(message) (in the last "else" of the OnReceive) to simply a Console.Write(message) as this allows the output to precisely echo the file input.
As I said, none of what I point out is AKKA.net related, but with the increased popularity of .net core, including developing on a MAC, having a lesson which works as expected allows the student to focus on learning AKKA, and not battling environmental differences from the bootcamp lessons that were built on the original .net framework, likely in Windows.
The text was updated successfully, but these errors were encountered: