In Unit 1, we learned some of the fundamentals of Akka.NET and the actor model.
In Unit 2 we learned some of the more sophisticated concepts behind Akka.NET, such as pattern matching, basic Akka.NET configuration, scheduled messages, and more!
In Unit 3, we're going to learn how to leverage the Task Parallel Library (TPL) and Akka.NET routers to scale out actor systems for massive performance boosts via parallelism.
Over the course of Unit 3, you're going to build a sophisticated GitHub scraper that can simultaneously retrieve data from multiple GitHub repos at once.
NOTE: If you're following along using the eBook / .ePub, you won't see the animation. Click here to see it.
This system will also be able to fetch information about the GitHubbers who have participated in those repos (e.g. starred or forked). By the end, we'll have a nicely scalable system for retrieving data from the GitHub API, capable of coordinating a huge amount of data retrieval in parallel (up to the allowed rate limit of the API, of course)!
In Unit 3 you will learn:
- How to use
Group
routers to divide work among your actors - How to use
Pool
routers to automatically create and manage pools of actors - How to use HOCON to configure your routers
- How to use
Ask
to wait inline for actors to respond to your messages - How to perform work asynchronously inside your actors using
PipeTo
In this lesson we'll also be introducing you to Octokit, the official GitHub SDK for .NET (and other languages!)
OCTOKIT NOTE: If you're working behind a proxy server and have issues connecting to the Github API with Octokit, try adding this to your config file and see if it fixes the issue:
<system.net><defaultProxy useDefaultCredentials="true" /></system.net>
If you have any questions about Octokit or want to learn more about it, make sure you check out Octokit.NET on GitHub!
- Lesson 1: Using
Group
routers to divide work among your actors - Lesson 2: Using
Pool
routers to automatically create and manage pools of actors - Lesson 3: How to use HOCON to configure your routers
- Lesson 4: How to perform work asynchronously inside your actors using
PipeTo
- Lesson 5: How to prevent deadlocks with
ReceiveTimeout
You will need to make a GitHub OAuth access token for the API.
This will be a throwaway token in your account only used for this app. Follow the instructions here and write down your OAuth token.
When you run the samples and are actually pulling data from GitHub, you will get two popup windows:
- The first popup window will ask you for your GitHub token. This is the read-only access token that you just created.
- The second window is where you'll enter the URL of the actual repo that you want to fetch info for.
This is where you enter your access token when you run the code:
NOTE: If you're following along using the eBook / .ePub, you won't see the animation. Click here to see it.
You will then get a second window, where you enter the URL of the repo you want to inspect:
NOTE: If you're following along using the eBook / .ePub, you won't see the animation. Click here to see it.
N.B. When working with the Github API, choose a repository that has a smaller number of followers - you might run out of API tokens rather quickly otherwise. If you run out of API tokens, repeat the steps above to get another OAuth token.
To get started, go to the /DoThis/ folder and open GithubActors.sln
.
And then go to Lesson 1.