Turns FileSystemWatcher events about a specific file into messages for TailActor.
Inheritance: IDisposable
コード例 #1
0
ファイル: TailActor.cs プロジェクト: peva0411/AkkaEmailCourse
 protected override void PostStop()
 {
     _observer.Dispose();
       _observer = null;
       _fileStreamReader.Close();
       _fileStreamReader.Dispose();
       base.PostStop();
 }
コード例 #2
0
ファイル: TailActor.cs プロジェクト: peva0411/AkkaEmailCourse
 protected override void PostStop()
 {
     _observer.Dispose();
     _observer = null;
     _fileStreamReader.Close();
     _fileStreamReader.Dispose();
     base.PostStop();
 }
コード例 #3
0
ファイル: TailActor.cs プロジェクト: Kaiotic/AkkaProjects
        /// <summary>
        /// Initialization logic for actor that will tail changes to a file.
        /// </summary>
        protected override void PreStart()
        {
            var fullPath = Path.GetFullPath(_filePath);

            // start watching file for changes
            _observer = new FileObserver(Self, fullPath);
            _observer.Start();

            // read the initial contents of the file and send it to console as first message
            _filereader = Context.ActorOf(FileReaderActor.GetProps(fullPath));
            Self.Tell(new InitialRead());
        }
コード例 #4
0
ファイル: TailActor.cs プロジェクト: njimenez/AkkaProjects
        /// <summary>
        /// Initialization logic for actor that will tail changes to a file.
        /// </summary>
        protected override void PreStart()
        {
            var fullPath = Path.GetFullPath( _filePath );

            // start watching file for changes
            _observer = new FileObserver( Self, fullPath );
            _observer.Start();

            // read the initial contents of the file and send it to console as first message
            _filereader = Context.ActorOf( FileReaderActor.GetProps( fullPath ) );
            Self.Tell( new InitialRead() );
        }
コード例 #5
0
        protected override void PreStart()
        {
            _observer = new FileObserver(Self, Path.GetFullPath(_filePath));
            _observer.Start();

            _fileStream       = new FileStream(Path.GetFullPath(_filePath), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            _fileStreamReader = new StreamReader(_fileStream, Encoding.UTF8);

            var text = _fileStreamReader.ReadToEnd();

            Self.Tell(new InitialRead(_filePath, text));
        }
コード例 #6
0
ファイル: TailActor.cs プロジェクト: peva0411/AkkaEmailCourse
        protected override void PreStart()
        {
            // start watching file for changes
              _observer = new FileObserver(Self, Path.GetFullPath(_filePath));
              _observer.Start();

              // open the file stream with shared read/write permissions (so file can be written to while open)
              _fileStream = new FileStream(Path.GetFullPath(_filePath), FileMode.Open, FileAccess.Read,
              FileShare.ReadWrite);
              _fileStreamReader = new StreamReader(_fileStream, Encoding.UTF8);

              // read the initial contents of the file and send it to console as first message
              var text = _fileStreamReader.ReadToEnd();
              Self.Tell(new InitialRead(_filePath, text));

              base.PreStart();
        }
コード例 #7
0
ファイル: TailActor.cs プロジェクト: peva0411/AkkaEmailCourse
        protected override void PreStart()
        {
            // start watching file for changes
            _observer = new FileObserver(Self, Path.GetFullPath(_filePath));
            _observer.Start();

            // open the file stream with shared read/write permissions (so file can be written to while open)
            _fileStream = new FileStream(Path.GetFullPath(_filePath), FileMode.Open, FileAccess.Read,
                                         FileShare.ReadWrite);
            _fileStreamReader = new StreamReader(_fileStream, Encoding.UTF8);

            // read the initial contents of the file and send it to console as first message
            var text = _fileStreamReader.ReadToEnd();

            Self.Tell(new InitialRead(_filePath, text));

            base.PreStart();
        }
コード例 #8
0
ファイル: TailActor.cs プロジェクト: Kaiotic/AkkaProjects
 /// <summary>
 /// Cleanup OS handles for <see cref="_fileStreamReader"/> and <see cref="FileObserver"/>.
 /// </summary>
 protected override void PostStop()
 {
     _observer.Dispose();
     _observer = null;
     base.PostStop();
 }
コード例 #9
0
ファイル: TailActor.cs プロジェクト: njimenez/AkkaProjects
 /// <summary>
 /// Cleanup OS handles for <see cref="_fileStreamReader"/> and <see cref="FileObserver"/>.
 /// </summary>
 protected override void PostStop()
 {
     _observer.Dispose();
     _observer = null;
     base.PostStop();
 }