0% found this document useful (0 votes)
305 views63 pages

Slides - Akka - NET Design Patterns PDF

This document provides an overview of an Akka.NET design and architecture patterns course. The course covers topics such as modeling application concerns as actors and conversations between those concerns, building effective actor hierarchies, messaging patterns, reliability patterns, testability patterns, and persistence patterns using Akka.NET and event sourcing. Code examples and diagrams are provided.

Uploaded by

d77b1388ef
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
305 views63 pages

Slides - Akka - NET Design Patterns PDF

This document provides an overview of an Akka.NET design and architecture patterns course. The course covers topics such as modeling application concerns as actors and conversations between those concerns, building effective actor hierarchies, messaging patterns, reliability patterns, testability patterns, and persistence patterns using Akka.NET and event sourcing. Code examples and diagrams are provided.

Uploaded by

d77b1388ef
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 63

Akka.

NET Design &


Architecture Patterns

@petabridge Petabridge.com
Akka.NET

@petabridge Petabridge.com
Petabridge

@petabridge Petabridge.com
@petabridge Petabridge.com
How This Course Works

@petabridge Petabridge.com
Example: AkkaChat!

@petabridge Petabridge.com
AkkaChat Technologies
•  NancyFX
•  SignalR
•  Dapper
–  SQL Server
•  Akka.NET
–  Akka.Persistence

@petabridge Petabridge.com
Demo

@petabridge Petabridge.com
Breaking Up Applications
into Concerns and Actor
Hierarchies

@petabridge Petabridge.com
Design Concerns

@petabridge Petabridge.com
Concerns as Conversations

@petabridge Petabridge.com
Example: Create User

@petabridge Petabridge.com
Example: Create User

@petabridge Petabridge.com
Exercise: Model Conversations
between Concerns

@petabridge Petabridge.com
Exercise: Model Conversations
between Concerns

@petabridge Petabridge.com
Exercise Results

@petabridge Petabridge.com
Exercise Results

@petabridge Petabridge.com
Exercise Results

@petabridge Petabridge.com
Model Conversations with
Actors

@petabridge Petabridge.com
Find Dependencies with
Questions

@petabridge Petabridge.com
Actors as Conversation
Participants

@petabridge Petabridge.com
Authorization: Is user
authorized to do X?

@petabridge Petabridge.com
What do we need to know?
•  Does this user actually exist?
•  Is this user who they claim to be?
•  Does this user have the correct rights?

@petabridge Petabridge.com
Separation of Concerns

@petabridge Petabridge.com
Message history: can I
accept and broadcast this
message?

@petabridge Petabridge.com
What do we need to know?
•  Who sent this message?
•  Is this message valid?
•  Can I add it to my history?
•  Who do I need to send it to?

@petabridge Petabridge.com
Separation of Concerns

@petabridge Petabridge.com
Building Effective Actor
Hierarchies

@petabridge Petabridge.com
Parents have direct access to
children

@petabridge Petabridge.com
Limit knowledge about cousins

@petabridge Petabridge.com
Communicate through the top

@petabridge Petabridge.com
Unique Properties
•  Parents can (and should) delegate risky
operations to their children
•  Actor classes can be deployed
anywhere in the hierarchy
•  Switchable behavior, FSMs, and Stashing
can be used instead of more actors
•  It's easy to pass top-level actors to
external contexts

@petabridge Petabridge.com
Organizing Hierarchies

@petabridge Petabridge.com
Exercise: Expand the
Hierarchy

@petabridge Petabridge.com
Exercise Results

@petabridge Petabridge.com
Actor Composition Patterns

@petabridge Petabridge.com
Child-per-Entity Pattern

@petabridge Petabridge.com
Fan-out Pattern

@petabridge Petabridge.com
Parent Proxy Pattern

@petabridge Petabridge.com
Messaging Patterns

@petabridge Petabridge.com
Request-Response

@petabridge Petabridge.com
Push and Pull

@petabridge Petabridge.com
Publish-Subscribe

@petabridge Petabridge.com
Reliability Patterns

@petabridge Petabridge.com
Character Actor

@petabridge Petabridge.com
Supervisor Strategy

@petabridge Petabridge.com
Consensus Pattern

@petabridge Petabridge.com
Testability Patterns

@petabridge Petabridge.com
Explicit Target

CODE

@petabridge Petabridge.com
Functional Props

CODE

@petabridge Petabridge.com
Dependency Injection

CODE

@petabridge Petabridge.com
Reply-to-Sender

DIAGRAM

@petabridge Petabridge.com
@petabridge Petabridge.com
Reply-to-Sender

CODE

@petabridge Petabridge.com
Persistence Patterns

@petabridge Petabridge.com
Disposable Repository Actor

CODE

@petabridge Petabridge.com
Reusable Repository Actor

CODE

@petabridge Petabridge.com
Reusable vs. Disposable
Repository Actors
•  Disposable Actor Lifecycle closely
follows repository lifecycle

•  Reusable Actor lifecycle is independent

@petabridge Petabridge.com
Event Sourcing w/
Akka.Persistence
DIAGRAMS

@petabridge Petabridge.com
@petabridge Petabridge.com
@petabridge Petabridge.com
Event Sourcing w/
Akka.Persistence
CODE

@petabridge Petabridge.com
Other Trainings

Akka.NET Remoting

Akka.NET Clustering

@petabridge Petabridge.com

You might also like