예제 #1
0
        public void On(SendContent message)
        {
            _fileWriter.WriteLine("Message: {0}; Success: {1}", message.Content, !message.Failed);
            TotalMessagesProcessed++;

            if (TotalMessagesProcessed % 100 == 0 || TotalMessagesProcessed % 100 == TotalMessagesProcessed)
            {
                Console.WriteLine("Total messages processed: {0}", TotalMessagesProcessed);
            }

            if (TotalMessagesProcessed == Generator.MessagesToBeSent)
            {
                AllJobDone.Set();
            }
        }
예제 #2
0
        public void On(SendContent message)
        {
            bool failed = false;

            try
            {
                var encoder = new ASCIIEncoding();
                var buffer  = encoder.GetBytes(message.Content);

                _clientStream.Write(buffer, 0, buffer.Length);
                _clientStream.Flush();
            }
            catch (Exception)
            {
                failed = true;
            }
            finally
            {
                System.Send(new SendContent(message, Addresses.DiskWriter, failed));
            }
        }
예제 #3
0
 public SendContent(SendContent message, ActorId newDestination, bool failed = false)
     : this(message.Content, newDestination, failed)
 {
 }