Git Product home page Git Product logo

akka-bootcamp's Introduction

Akka.NET Bootcamp

Welcome to Akka.NET Bootcamp! This is a free, self-directed learning course brought to you by the folks at Petabridge.

Get Akka.NET training material & updates at https://petabridge.com/bootcamp/signup

Discord

Over the three units of this bootcamp you will learn how to create fully-functional, real-world programs using Akka.NET actors and many other parts of the core Akka.NET framework!

We will start with some basic actors and have you progressively work your way up to larger, more sophisticated examples.

The course is self-directed learning. You can do it at whatever pace you wish. You can sign up here to have one Akka.NET Bootcamp lesson emailed to you daily if you'd like a little help pacing yourself throughout the course.

NOTE: F# support is in progress (see the FSharp branch). We will happily accept F# pull requests. Feel free to send them in.

What will you learn?

In Akka.NET Bootcamp you will learn how to use Akka.NET actors to build reactive, concurrent applications.

You will learn how to build types of applications that may have seemed impossible or really, really hard to make prior to learning Akka.NET. You will walk away from this bootcamp with the confidence to handle bigger and harder problems than ever before!

Unit 1

In Unit 1, we will learn the fundamentals of how the actor model and Akka.NET work.

*NIX systems have the tail command built-in to monitor changes to a file (such as tailing log files), whereas Windows does not. We will recreate tail for Windows and use the process to learn the fundamentals.

In Unit 1 you will learn:

  1. How to create your own ActorSystem and actors;
  2. How to send messages actors and how to handle different types of messages;
  3. How to use Props and IActorRefs to build loosely coupled systems.
  4. How to use actor paths, addresses, and ActorSelection to send messages to actors.
  5. How to create child actors and actor hierarchies, and how to supervise children with SupervisionStrategy.
  6. How to use the Actor lifecycle to control actor startup, shutdown, and restart behavior.

Begin Unit 1.

Unit 2

In Unit 2, we're going to get into some more of the intermediate Akka.NET features to build a more sophisticated application than what we accomplished at the end of unit 1.

In Unit 2 you will learn:

  1. How to use HOCON configuration to configure your actors via App.config and Web.config;
  2. How to configure your actor's Dispatcher to run on the Windows Forms UI thread, so actors can make operations directly on UI elements without needing to change contexts;
  3. How to handle more sophisticated types of pattern matching using ReceiveActor;
  4. How to use the Scheduler to send recurring messages to actors;
  5. How to use the Publish-subscribe (pub-sub) pattern between actors;
  6. How and why to switch actor's behavior at run-time; and
  7. How to Stash messages for deferred processing.

Begin Unit 2.

Unit 3

In Unit 3, we will learn how to use actors for parallelism and scale-out using Octokit and data from Github repos!

In Unit 3 you will learn:

  1. How to perform work asynchronously inside your actors using PipeTo;
  2. How to use Ask to wait inline for actors to respond to your messages;
  3. How to use ReceiveTimeout to time out replies from other actors;
  4. How to use Group routers to divide work among your actors;
  5. How to use Pool routers to automatically create and manage pools of actors; and
  6. How to use HOCON to configure your routers.

Begin Unit 3.

How to get started

Here's how Akka.NET bootcamp works!

Use Github to Make Life Easy

This Github repository contains Visual Studio solution files and other assets you will need to complete the bootcamp.

Thus, if you want to follow the bootcamp we recommend doing the following:

  1. Sign up for Github, if you haven't already.
  2. Fork this repository and clone your fork to your local machine.
  3. As you go through the project, keep a web browser tab open to the Akka.NET Bootcamp ReadMe so you can read all of the instructions clearly and easily.

Bootcamp Structure

Akka.NET Bootcamp consists of three modules:

  • Unit 1 - Beginning Akka.NET
  • Unit 2 - Intermediate Akka.NET
  • Unit 3 - Advanced Akka.NET

Each module contains the following structure (using Unit 1 as an example:)

src\Unit1\README.MD - table of contents and instructions for the module
src\Unit1\DoThis\ - contains the .SLN and project files that you will use through all lessons
-- lesson 1
src\Unit1\Lesson1\README.MD - README explaining lesson1
src\Unit1\Lesson1\DoThis\ - C# classes, etc...
src\Unit1\Lesson1\Completed\ - "Expected" output after completing lesson
-- repeat for all lessons

Start with the first lesson in each unit and follow the links through their README files on Github. We're going to begin with Unit 1, Lesson 1.

Lesson Layout

Each Akka.NET Bootcamp lesson contains a README which explains the following:

  1. The Akka.NET concepts and tools you will be applying in the lesson, along with links to any relevant documentation or examples
  2. Step-by-step instructions on how to modify the .NET project inside the Unit-[Num]/DoThis/ to match the expected output at the end of each lesson.
  3. If you get stuck following the step-by-step instructions, each lesson contains its own /Completed/ folder that shows the full source code that will produce the expected output. You can compare this against your own code and see what you need to do differently.

When you're doing the lessons...

A few things to bear in mind when you're following the step-by-step instructions:

  1. Don't just copy and paste the code shown in the lesson's README. You'll retain and learn all of the built-in Akka.NET functions if you type out the code as it's shown.
  2. You might be required to fill in some blanks during individual lessons. Part of helping you learn Akka.NET involves leaving some parts of the exercise up to you - if you ever feel lost, always check the contents of the /Completed folder for that lesson.
  3. Don't be afraid to ask questions. You can reach the Petabridge team and other Akka.NET users in our Gitter chat here.

Docs

We will provide explanations of all key concepts throughout each lesson, but of course, you should bookmark (and feel free to use!) the Akka.NET docs.

Tools / prerequisites

This course expects the following:

  • You have some programming experience and familiarity with C#
  • A Github account and basic knowledge of Git.
  • You are using a version of Visual Studio (it's free now!)
    • These lessons are designed to run on Windows only due to the limitation of the WindowsForms framework.

Enough talk, let's go!

Let's begin!

About Petabridge

Petabridge logo

Petabridge is a company dedicated to making it easier for .NET developers to build distributed applications.

Petabridge also offers Akka.NET consulting and training - so please sign up for our mailing list!


Copyright 2015-2020 Petabridge, LLC

akka-bootcamp's People

Contributors

8 avatar aaronontheweb avatar arkatufus avatar chaks7 avatar fantasticfiasco avatar featuresnap avatar gitter-badger avatar gskoczylas avatar gstraube avatar horsdal avatar izavala avatar jimmyhannon avatar jorgef avatar khalidabuhakmeh avatar kjellski avatar levi-rocha avatar mausch avatar nathvi avatar nullpainter avatar oleggavrilov avatar pettys avatar qujck avatar ralphwillgoss avatar rjanisch avatar ryanhauert avatar sakowiczm avatar skazantsev avatar skotzko avatar skydvr avatar wralph avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

akka-bootcamp's Issues

Lesson 1.2 - repeated instruction

The reader is instructed to change consoleReaderActor.Tell("start");to consoleReaderActor.Tell(ConsoleReaderActor.StartCommand); in two different locations in the text.

Lesson 1.3

Step 1 of "Experience the danger..." probably shouldn't say to open WinTail.sln. The code to uncomment is in Program.cs.

Lesson 2.3 - completed code throws an unhandled NullReferenceException on exit

When running the completed code or the code I wrote following the guide I get an unhandled NullReferenceException in ChartingActor.cs in HandleMetrics (See comment below)

private void HandleMetrics(Metric metric)
    {
        if (!string.IsNullOrEmpty(metric.Series) && _seriesIndex.ContainsKey(metric.Series))
        {
            var series = _seriesIndex[metric.Series];
            series.Points.AddXY(xPosCounter++, metric.CounterValue); // <- series.Points is null!
            while(series.Points.Count > MaxPoints) series.Points.RemoveAt(0);
            SetChartBoundaries();
        }
    }

I've managed to reproduce the problem when enabling all performance counters, disabling them and enabling them again and then exit the application.

Blocking an Actor in Unit-3/lesson2

As I understand actors Receive delegate should be non blocking.

var getStars = _gitHubClient.Activity.Starring.GetAllStargazers(starrers.Owner, starrers.Repo);

//ewww
getStars.Wait();

So the question is how to code non blocking io operation, e.g http request, and another question
is how to code cpu intensive tasks with actors.

Thank you!

FileSystemWatcher() issues in Xamarin/Mono

Currently working Bootcamp in a Xamarin/Mono 3.12.0 environment. In Lesson 1.4 there's a problem with FileSystemWatcher() which has been a nuisance bug to the Mono community for a while where the Changed state is never passed. Here's the Bugzilla: https://bugzilla.xamarin.com/show_bug.cgi?id=19741

The following is a partial workaround but I haven't had time to properly debug it. This workaround allows for the Changed state to pass but then it seems something might not be working with TailActor(). The workaround is discussed here: http://stackoverflow.com/questions/16859372/why-doesnt-the-servicestack-razor-filesystemwatcher-work-on-mono-mac-os-x

The workaround -- in FileObserver.cs -> Start(), before the _watcher = new FileSystemWatcher(...), insert

// Need this for Mono 3.12.0 workaround
Environment.SetEnvironmentVariable("MONO_MANAGED_WATCHER", "enabled");

Haven't hide time to follow through but I know I need to at least drop this here! Will check back in later this evening and try some more debugging.

DropBox blocked at work

Sites such as OneDrive and DropBox are blocked at my company. It might be nice to offer an alternative for those of us in Internet Jail.

Lession 5 dead letters

I'm running using mono on linux and seem to be getting a deadletter error. This occurs on both the solution I modified as well as the completed solution you provide.

This is what I get

Please provide the URI of a log file on disk.

file.log
[INFO][12/03/2015 10:43:41 p.m.][Thread 0005][akka://MyActorSystem/deadLetters] Message String from akka://MyActorSystem/user/consoleReaderActor to akka://MyActorSystem/deadLetters was not delivered. 1 dead letters encountered.

Lesson 1.1 gramma

In the part "What is an actor"

everything is an object in OOP, in the actor modeleverything is an actor.
Repeat this train of thought to yourself.

modeleverything needs a space -> model everything
And after the sentence there should be properly another newline ;-)

image

Lesson 1.2 typo

This is the code for "GetAndValidateInput" from the lesson 1.2 email:

/// <summary>
/// Reads input from console, validates it, then signals appropriate response
/// (continue processing, error, success, etc.).
/// </summary>
private void GetAndValidateInput()
{
    var message = Console.ReadLine();

...

    else
    {
        var valid = IsValid(message);
        if (valid)
        {
            _consoleWriterActor.Tell(new Messages.InputSuccess("Thank you! Message was valid."));
        }
        else
        {
            Self.Tell(new Messages.ValidationError("Invalid: input had odd number of characters."));
        }

        // continue reading messages from console
        Self.Tell(new Messages.ContinueProcessing());
    }
}

The "Self.Tell" in this line should actually be _ConsoleWriterActor.Tell:

    Self.Tell(new Messages.ValidationError("Invalid: input had odd number of characters."));

Lesson 2.3: Performance counter not initializing

When running the completed solution for lesson 2.3 I receive the following error when the below code is run on start up

{CounterType.Cpu, () => new PerformanceCounter("Processor", "% Processor Time", "_Total", true)}

An exception of type 'System.InvalidOperationException' occurred in System.dll but was not handled in user code
Additional information: Cannot load Counter Name data because an invalid index '' was read from the registry.

To solve this we need to clear the counter cache. Solution is here. You might want to add a note to the lesson about this.

Lesson 2.5 - wrong code in exercise

The code is wrong in the 2.5 exercise, in Phase 2, in the new implementation of the Pause() method, in the Receive handler for TogglePause messages, Unbecome() is called instead of UnbecomeStacked(). The actual code is correct.

InvalidOperationException in Unit2->DoThis

Exception:

An exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll but was not handled in user code

Additional information: Cross-thread operation not valid: Control 'sysChart' accessed from a thread other than the thread it was created on.

Stack trace

   at System.Windows.Forms.Control.get_Handle()
   at System.Windows.Forms.Control.Invalidate(Boolean invalidateChildren)
   at System.Windows.Forms.DataVisualization.Charting.Chart.Invalidate()
   at System.Windows.Forms.DataVisualization.Charting.Data.DataManager.Invalidate()
   at System.Windows.Forms.DataVisualization.Charting.ChartElement.System.Windows.Forms.DataVisualization.Charting.IChartElement.Invalidate()
   at System.Windows.Forms.DataVisualization.Charting.ChartElementCollection`1.Invalidate()
   at System.Windows.Forms.DataVisualization.Charting.ChartElementCollection`1.ResumeUpdates()
   at System.Windows.Forms.DataVisualization.Charting.ChartElementCollection`1.ClearItems()
   at System.Collections.ObjectModel.Collection`1.Clear()
   at ChartApp.Actors.ChartingActor.HandleInitialize(InitializeChart ic) in c:\Users\keks\Projects\akka-bootcamp\src\Unit-2\DoThis\Actors\ChartingActor.cs:line 58
   at ChartApp.Actors.ChartingActor.OnReceive(Object message) in c:\Users\keks\Projects\akka-bootcamp\src\Unit-2\DoThis\Actors\ChartingActor.cs:line 43
   at Akka.Actor.UntypedActor.Receive(Object message)
   at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message)
   at Akka.Actor.ActorCell.ReceiveMessage(Object message)
   at Akka.Actor.ActorCell.Invoke(Envelope envelope)

Lesson 1.6 - PostStop gets called by PreRestart

Actual source code for PreRestart

 /// <summary>
        ///     User overridable callback: '''By default it disposes of all children and then calls `postStop()`.'''
        ///     <p />
        ///     Is called on a crashed Actor right BEFORE it is restarted to allow clean
        ///     up of resources before Actor is terminated.
        /// </summary>
        /// <param name="reason">the Exception that caused the restart to happen.</param>
        /// <param name="message">optionally the current message the actor processed when failing, if applicable.</param>
        protected virtual void PreRestart(Exception reason, object message)
        {
            Context.GetChildren().ToList().ForEach(c =>
            {
                Context.Unwatch(c);
                Context.Stop(c);
            });
            PostStop();

Directly contradicts https://github.com/petabridge/akka-bootcamp/tree/master/src/Unit-1/lesson6#poststop

Lesson 1.2 - check if message is start message

The following line of code:

if (message.Equals(StartCommand))

I was wondering if a passed on message can be null. I couldn't find anything this way in the documentation so I assume it could be and therefore the could would be less fragile this way:

if (message == StartCommand)

or

if (StartCommand.Equals(message))

Lesson 1.1 - grammar

Strange sentence here:

But in addition to processing messages it receives, and actors are also able to do 3 other special actions:

Lesson 4 - 6, FileObserver._absoluteFilePath not needed?

It looks like the field FileObserver._absoluteFilePath isn't actually used since the file name and directory are parsed out and stored separately. If that's accurate (and don't think there's a reason to keep it), I'd be happy to submit a PR removing it from the lesson sources and text.

Lesson 1.4 Actor address wrong

In section "The /user actor hierarchy", it states:

For example, if we were running on localhost, the full address of actor b2 would beakka.tcp://MyActorSystem@localhost:9001/user/a1/b2

Based on the examples, I believe it should be:
akka.tcp://MyActorSystem@localhost:9001/user/a2/b2

providing file URI in console

what is the valid URI format that I can provide in the console window when the program runs? say I have my log file on the C drive in this path C:\test\log.txt

Lesson 1.5 Exercise "Build and Run!"

In the explanation at the conclusion of exercise 1.5, it says:

"This one is a little counter-intuitive. Here's the deal. In this case, we aren't using the handle for consoleWriterActor to talk directly to it. Instead we are putting that IActorRef inside a message that is getting sent somewhere else in the system for processing."

However, at this point in the exercises the code is still making direct "Tell()" calls using the _consoleWriterActor in several places in FileValidatorActor (in the distributed "Completed" code) along with packaging it into a StartTail message. Of course this misstatement doesn't change the overall spirit of the explanation. I just found it a distraction.

NullReferenceException sometimes occurs

Hello,
Just passed lessons 3 and 4, noticed that a NullReferenceException sometimes occurs in ChartingActor in method HandleMetrics on series.Points object. This exception occurs when closing the application.

Issues with Charting App in Unit 2

With the completed charting app, it seems the desired behavior is that if you pause the app, the old data will continue to move to the left, with all new data points being at Y=0 (bottom of the chart).

But, if you pause the chart, and then turn off all of the toggles it will stop moving the old data to the left. Additionally if you turn any of them back on (still in the paused state), the data will again move to the left (because the toggles do not involve the charting actor directly -- it just receives the add/remove series events).

I recommend passing the toggle messages to the charting actor instead of the toggle actors directly. This way, the charting actor can decide if it wants to route the messages on to the toggle actors, or if it would rather stash them instead.

Lesson 3: outdated sources in DropBox's ZIP?

In Lesson 3.3 we are asked to update the implementation of BecomeAsking in GithubCommanderActor, but it's does not exist in the ZIP version downloaded from DropBox (link received in email).

Analysing "Completed" code from Git repo, it seems that the ZIP is outdated.

Typo's and 'bugs' in lesson 2.3

I will enumerate all the things I noticed in this lesson.

In no particular order:

  • High level overview image points to the wrong url: It should be: https://github.com/petabridge/akka-bootcamp/blob/master/src/Unit-2/lesson3/images/system_overview_2_3.png
  • In the introduction to scheduling a code snippet contains the wrong code to access the scheduler from inside an actor: It says: Context.System.system.Scheduler.ScheduleOnce() where it should obviously be: Context.System.Scheduler.ScheduleOnce()
  • I noticed one grammar error. This sentence is wierd: "Scheduled messages become are scheduled onto the CLR threadpool and use Task.Delay under the hood. "

Thats it :)

Lesson 1.4 - Tail OutOfMemory Exception on large files

I tried out the tails on some real world 1.7GB log file (yeah I should trim it) and got an OutOfMemory Exception (ok what did I really expect - ReadToEnd on that file ...). So I tried to "fix" it. I wrote my own ReadToEnd where I'm reading chunks of 1MB:

    private const int MaxCharsToRead = 1024 * 1024; // 1MB

    private string ReadToEnd() 
    {
        var buffer = new char[MaxCharsToRead];
        var charsRead = _fileStreamReader.ReadBlock(buffer, 0, MaxCharsToRead);

        if (charsRead == buffer.Length) // buffer is full, probably more bytes waiting
        {
            Self.Tell(new FileWrite(_filePath));   
        }
        return new string(buffer);
    } 

Additionally, I've changed the end of the constructor to:

    Self.Tell(new FileWrite(_filePath));

So that I wouldn't really need the InitialRead anymore, but now two things:

  1. is this a good approach? Is Akka.Net (or the actor model in general) supposed to be used like this?
  2. This works when I redirect stdout to a file, but I'm still getting OutOfMemory errors when having normal console output. Is there a way to throttle this? I could have a callback - notifying that the message has been processed and the next message can be processed, but that would be quite complicated (given the existing solution) and not really useful, as I want to process the messages at my pace, not knowing what kind of actors are sitting behind.

full code can be found here: https://github.com/pgrm/akka-bootcamp/blob/master/src/Unit-1/DoThis/TailActor.cs

Lesson 1.4 - Wrong Code to create ValidationActor

In lesson 1.4 we're advised to update the ValidationActor constructor to take two parameters, but when we're asked to update the instantiation code, the new code still only contains one parameter -- this doesn't work!

New code that still only uses one parameter:

Props validationActorProps = Props.Create(() => new FileValidatorActor(consoleWriterActor));

We're never asked to update this code to add in the second parameter. -- It's easy enough to figure this out, but the code & instructions should still be updated.

Proxy Servers...

Hi,
I'm working behind a proxy and I had issues connecting to github using octokit. I managed to solve this issue by adding the following settings to the configuration file.
<system.net>
<defaultProxy useDefaultCredentials="true" />
</system.net>

Lesson 3: Warning 'Repository.SubscribersCount' is obsolete:

It seems Octokit has evolved. There is a warning message in the lesson 3 solution:

Warning CS0618 'Repository.SubscribersCount' is obsolete: 'This property has been obsoleted. Please use WatchedClient.GetAllWatchers instead.' ...\Visual Studio 2015\Projects\GithubActors\Actors\RepoResultsActor.cs 61

                row.Cells[4].Value = repo.SubscribersCount;

Lesson 2.4 - confusing presentation of Become/BecomeStacked

The whole section starting with Use Become to adopt a new behavior confused me for a minute - the animated diagrams of how the stack works are labled Become(...), not BecomeStacked(...). There is also a note saying Become will delete the old behavior off the stack, making me wonder what the deal was with all this stack talk if it always deletes the previous top?!

It was just confusing for a bit - maybe explicitly say early on there are 2 variations - Become() clears the stack and pushes, BecomeStacked() just pushes?

Lesson 1.4 final diagram

In the lesson 1.4 final diagram I think, but I am not 100% sure, that FileObserver sends FileWrite to TailActor and not to TailCoordinatorActor.

Markdown code samples not rendering correctly

Code samples in the readme.md files are started with

```csharp

That seems to work well when displayed online in GitHub. But if I look at the .md file with a markdown editor like Mou it does not render well:

bildschirmfoto 2015-02-23 um 12 21 16

So the question should really be: What to optimize the markdown for? GitHub or any other markdown editor/reader?

Lession 1.2, code differs from mail to completed example

In the mail the code is written like this

private void GetAndValidateInput()
{
    var message = Console.ReadLine();
    <snip if string.IsEmptyOrNull part>
    else
    {
        var valid = IsValid(message);
        if (valid)
        {
            _consoleWriterActor.Tell(new Messages.InputSuccess("Thank you! Message was valid."));
        }
        else
        {
            Self.Tell(new Messages.ValidationError("Invalid: input had odd number of characters."));
        }

        // continue reading messages from console
        Self.Tell(new Messages.ContinueProcessing());
    }
}

However, this results in unexpected behavior when an invalid message are entered - upon pressing enter, nothing happens - and then the parsing of the messages are delayed by a few Console.ReadLine's.

In the examples in your completed folder, it is correctly written like this (same part of the funtion)

var valid = IsValid(message);
if (valid)
{
    consoleWriterActor.Tell(new Messages.InputSuccess("Thank you! Message was valid."));

     // continue reading messages from console
    Self.Tell(new Messages.ContinueProcessing());
}
else
{
    Self.Tell(new Messages.ValidationError("Invalid: input had odd number of characters."));
}

Where the Self.Tell part has been moved into the if(valid) part of the if statement.

Difficult Naming in 3.1

I'm trying to make sense of the code as I'm going through it, and am really stumbling over how things are named. The two things that create ambiguity are:

  • We have GithubCommanderActor and GithubCoordinatorActor. I'm trying to reason in my mind about what might be the difference between something that "commands" and something that "coordinates." I don't think this is very clear. To make the point, the comment for GithubCommanderActor says, "Top-level actor responsible for coordinating...".
  • For the commander's messages, we've got CanAcceptJob and AbleToAcceptJob. Again, just looking at these names, it's hard to distinguish what they are used for -- seems like two ways of saying the same thing. I'm pretty sure that "can" and "able to" are exactly synonymous. This makes it hard to comprehend what GithubCommanderActor is doing as I read through the code.

Could these names be changed to something more descriptive that could be used to help a newcomer to the code follow along? If something occurs to me when I reach the end of the lesson I'll update this issue.

Lesson 1.2: Defining and Handling Messages

Following lessons 1.1 and 1.2 from the email instructions leaves the program.cs Main with Actor creation like this:

var consoleWriterActor = MyActorSystem.ActorOf(Props.Create(() => new ConsoleWriterActor()));
var consoleReaderActor = MyActorSystem.ActorOf(Props.Create(() => new ConsoleReaderActor(consoleWriterActor)));

This gave me a build error on the following line:
consoleReaderActor.Tell(ConsoleReaderActor.StartCommand);

"StartCommand" unable to resolve symbol.

The completed code example has the creation of the Actors with names being assigned to them:
// make our first actors!
IActorRef consoleWriterActor = MyActorSystem.ActorOf(Props.Create(() => new ConsoleWriterActor()),
"consoleWriterActor");
IActorRef consoleReaderActor =
MyActorSystem.ActorOf(Props.Create(() => new ConsoleReaderActor(consoleWriterActor)),
"consoleReaderActor");

Which resolves the build issue, but doesn't explain why you need to pass in the second (name) parameter when creating your Actors.

[Unit 1 Lesson 4] TailActor never closes the file stream

In TailActor.cs the actor opens and holds a Stream pointing to the input file. The actor never closes the stream or associated stream reader.

This is probably not an issue in this particular case, since the stream is supposed to be opened for the duration of the app but since this is lesson material it might be a good idea to clarify such use cases. Or maybe show how to control the lifetime of the actor & stream.

Nevertheless this raises a few questions:

Should actors own disposable resources? If yes when are these resources supposed to be released?

Assuming an app needs to open and close multiple files what is the best way to ensure no resources are leaked?

Is the general recommendation to avoid controlling resource lifetime with messages (for ex to have a message to open the file and a message to close the file) and instead have the resource operation inside a message handler ( on receive ReadFromFile message - open file, read content, close file - pass content to other actor ).?

Thanks, and btw awesome idea with the akka bootcamp.

Lesson 1, unclear where to put code in ConsoleReaderActor.cs

The instructions just say:

ConsoleReaderActor is set up to read from the console. Have it send a message to ConsoleWriterActor containing the content that it just read.

   // in ConsoleReaderActor.cs
   _consoleWriterActor.Tell(read);

So you know what file to put it into, but not where (i.e. what method) -- I almost just put it in the constructor (since that's basically what we were doing up until that step), but then I thought better of it and decided to search around, and finally identified the comment in the code.

Please include more details in the walkthrough.

Readme for lesson 3.3 has an unclear section

Lines 91-93 of Unit-3\lesson3\README.md looks like this:

#### How do I use the HOCON config?
setting up router needs a router config
as long as the router config passed isn't "no router" then it will

This is not written as a complete sentence; I actually have no idea what is meant.

Problem with "create an issue" link in emails

At the bottom of the lessons is a paragraph that says:

If there is a problem with the code running, or something else that needs to be fixed in this lesson, please create an issue and we'll get right on it. This will benefit everyone going through Bootcamp.

The "create an issue" link is invalid for the three lessons I've received so far. It takes me to a GitHub 404 page.

Lesson 3.2 (Pool Router) - Octokit.ForbiddenException

Hello,
In Unit 3, Lesson 2, after using the pool router to accelerate the job I discovered that the tool was unable to complete the fetch for some repositories.
It is annoying since it cannot allow us to see the performance difference for the entire process.
After investigation I saw that it comes from an Octokit.ForbiddenException with the following message:

"You have triggered an abuse detection mechanism and have been temporarily blocked from calling the API. Please retry your request again later."

It makes sense and I'm not sure that is a real issue. I just wanted to let you know about that.
Maybe I missed something or it could be a good idea to detect these kind of errors and notify the user.

If you need more information let me know!

Lesson 1.2 - casting

There is no need to cast message object when it is told actor.
This

            else if(message is Messages.InputError)
            {
                _consoleWriterActor.Tell(message as Messages.InputError);
            }

gives the same result as

            else if(message is Messages.InputError)
            {
                _consoleWriterActor.Tell(message);
            }

Charting method in Lesson 2.4 slightly off

When we replace all of the ChartingActor's Receive declarations into their own method, the presented code does not show the type parameter, but is required since it cannot be inferred from the delegate.

private void Charting()
{
    Receive(ic => HandleInitialize(ic));
    Receive(addSeries => HandleAddSeries(addSeries));
    Receive(removeSeries => HandleRemoveSeries(removeSeries));
    Receive(metric => HandleMetrics(metric));
    Receive(pause =>
    {
        SetPauseButtonText(true);
        BecomeStacked(Paused);
    });
}

Should be:

        private void Charting()
        {
            Receive<InitializeChart>(ic => HandleInitialize(ic));
            Receive<AddSeries>(addSeries => HandleAddSeries(addSeries));
            Receive<RemoveSeries>(removeSeries => HandleRemoveSeries(removeSeries));
            Receive<Metric>(metric => HandleMetrics(metric));
            Receive<TogglePause>(pause =>
            {
                SetPauseButtonText(true);
                BecomeStacked(Paused);
            });
        }

Same issue for the Paused method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.