Async / Await vs. PipeTo in Akka.NET Actors

Best Practices and Patterns for Asynchronous Programming with Akka.NET Actors

Many years ago I wrote an article entitled “How to Do Asynchronous I/O with Akka.NET Actors Using PipeTo” - back when await support was still very much a work in progress. I subsequently wrote a major update on that article in 2016 - talking mostly about the benefits of PipeTo from a structural point of view.

I recently learned that this article has many of our own users under the impression that Akka.NET actors don’t support await semantics properly and that PipeTo is the only “blessed” pathway for working with asynchronous operations inside actors. This is not the case - await has had first class support inside actors for many years now.

That’s what this post and video cover: async, await, and PipeTo - how do they work differently, when should you consider using one over the other, and what are the “gotchas” that you need to know?

If you want to see the code sample that goes along with this video and blog post, you can find that here: https://github.com/Aaronontheweb/Akka.AsyncAwait

Phobos Updates: Improvements and Upcoming OpenTelemetry Support

Tracing Ask and PipeTo Operations; Measuring Message Latency; and Phobos 2.0 Beta with OpenTelemetry Support

Since announcing Phobos 1.0 a year ago we’ve made many significant changes to it that should add many useful new ways to observe the run-time behavior of your Akka.NET applications in production.

Phobos logo

Phobos is a commercial add-on for Akka.NET that allows developers to automatically record distributed traces and metrics from their actors without the need for any manual instrumentation code.

In this post we’re going to cover:

  • Improvements that have been made to Phobos all the way up through the v1.3.2 version released on December 21st, 2021;
  • Phobos 2.0, which will be built entirely upon OpenTelemetry and should be in beta soon; and
  • Our ongoing support plan for Phobos 1.x and 2.x over the next two years.

A concept I’ve been trying to put a name to is software application architectures that inherently lend themselves to a lower rate of technical debt accumulation than others. This post is my first attempt to do that.

Technical Debt

Technical debt is a term that is used frequently in our industry and while its meaning is commonly understood among experienced technologists, it’s not clearly defined.

In the abstract:

  • Technical debt is cost incurred from software design and implementation choices made in the past;
  • Interest on that technical debt accrues and compounds as a result of subsequent decisions that are layered onto the original set of choices; and
  • The full cost of technical debt is not known until, at some point in the future, there is a need to modify the software system which forces the development team to modify the original choices built into the existing system and calculate the level of effort needed to change them safely.

Why and When to Use Akka.Streams

A recording of our recent webinar 'Introducing Akka.NET Streams' and more.

On this blog before we’ve covered a high level introduction to Akka.Streams for Akka.NET, but in this post we go into some more detail on:

  1. What is Akka.Streams;
  2. The motivations for using Akka.Streams; and
  3. When should you use Akka.Streams?

Best Practices for Integrating Akka.NET with ASP.NET Core and SignalR

How to Host Akka.NET Inside ASP.NET Core and SignalR Applications

In the recent past we blogged about hosting headless Akka.NET services using IHostedService and we thought we’d extend that train of thought to cover ASP.NET Core. .NET’s web ecosystem has changed a lot since 2015, when we last wrote about hosting Akka.NET with ASP.NET MVC and even NancyFX on .NET Framework 4.5 - so we’re due for an update.

So, we went ahead and put together a video: “Best Practices for Integrating Akka.NET and ASP.NET Core” which demonstrates how to work with Akka.NET and ASP.NET Core inside a single process.

This blog post accompanies that video and expands on some of the advice we give in it!

NOTE: Also, please check out our Petabridge.App.Web dotnet new template to use these patterns straight away inside your own applications!

Case Study: Vertech Using Akka.NET for Device Simulation

Vertech Akka.NET Case Study: Using Akka.NET to Simulate PLCs in Airport Baggage Handling Systems

Vertech Logo

Vertech is an industrial automation and information solutions company based out of the United States that develops solutions for a broad range of industries.

This case study was authored by John Wolnisty, a Solutions Architect at Vertech who, in the context of this case study, used Akka.NET to help test, simulate, and build solutions for airport baggage handling systems.

What does Vertech do?

Based in Phoenix, Arizona, Vertech designs and implements industrial automation solutions including traditional automation systems, SCADA systems, MES solutions, and OT networks. One of our industry focuses is airport baggage handling systems. A large airport can have hundreds of conveyors that need to be integrated and controlled by the system. Airport security requirements add layers of complexity requiring control systems that account for every bag on a conveyor and track suspicious activities, such as a bag suddenly disappearing or a new bag appearing from the middle of a conveyor. At Vertech we provide comprehensive solutions that handle all these details by personally writing everything from automation code in PLCs to the high-level systems that interface with airline data feeds.

What problem were you trying to solve?

A PLC (Programmable Logic Controller) is an industrial computer repetitively running logic that reads input sensors, implements operational behaviors and controls outputs. Inputs are control panel switches, push buttons, photo-eyes and the like. Outputs are motors, lights, warning horns and other devices. The PLC programmers have a problem, especially with a large system, of being unable to develop and test their code without the physical hardware being present. We had a need for a system that could simulate the conveyor hardware, provide relatively seamless connections with the PLCs, display the output conditions, and log what was going on without having to set up...

How to Build Headless Akka.NET Services with IHostedService

Creating Stand-alone Akka.NET Services with Microsoft.Extensions.Hosting and IHostedService

At Akka.NET’s inception, most of the server-side code samples we produced all demonstrated how to build so-called “headless” Akka.NET services as outright Windows Services primarily using libraries like Topshelf.

.NET has changed tremendously since then and become a truly cross-platform runtime that is capable of working with and within all of the amazing innovations that have sprung from the greater global open source community, such as Kubernetes and Docker. Thus, it’s time we modernize our guidance for how to build headless services in the age of .NET Core / .NET 5 and beyond.

We’ve produced a YouTube video demonstrating how to Host Akka.NET using IHostedService which demonstrates the modern approach to configuring and hosting stand-alone Akka.NET services:

This blog post compliments the YouTube video!

Akka.NET Dependency Injection Best Practices

How to work with the new Akka.DependencyInjection library and Microsoft.Extensions.DependencyInjection

As part of the Akka.NET v1.4.15 release we’ve completely rewritten how dependency injection works in Akka.NET and introduced a new library: Akka.DependencyInjection. In this blog post we’re going to introduce Akka.DependencyInjection and some of the best practices for working with it.

We’ve also produced a brief YouTube video that demonstrates how to work with Akka.DependencyInjection too:

Real World Akka.NET Clustering: Process Managers and Long-Running Operations

Using Process Managers with Akka.Persistence and Akka.Cluster.Sharding to Manage Complex, Long-Running Workflows

In our previous installment of “Real World Akka.NET Clustering”, we covered state machines - the tried and true tool for modeling event-driven behavior for business entities inside your domain. And we also demonstrated that using Akka.NET programming techniques such as behavior-switching it’s straightforward to implement them with actors.

In this post we’re going to take our discussion of real-world Akka.NET actors to a higher level and discuss how to use the process manager pattern with actors to model long-running, stateful workflows that naturally occur in all sorts of business domains.

Process Managers

What is a process manager? A process manager is a state machine used to direct a dynamic, stateful workflow. In the context of modern software applications most process managers tend to be responsible for managing distributed workflows that are executed across different services or multiple instances of a service.

Process managers are:

  1. Reentrant - when we say “long-running” in the context of a workflow this often means durations measured in minutes, hours, or days - not seconds. Therefore, process managers are often programmed so they can be passivated (i.e. put to sleep) and recovered at a future point in time. We typically accomplish this using Akka.Cluster.Sharding in Akka.NET.
  2. Durable - in order to be reentrant process managers must persist their state to a durable store of some kind, typically either a cloud filesystem or a database. This is a good fit for Akka.Persistence.
  3. Driven by State Changes - process managers determine the next course of action in a workflow based on the output of the current and previous states. If we’re in error, perhaps we retry the most recent failed operation. If the operation failed irrecoverably, maybe we need to perform some reverisions and send a report back upstream.
  4. Not Responsible for...

Phobos v1.0.0 - Programmatic Configuration, Improved Integrations, and Reduced Pricing

Phobos 1.0.0 is Cheaper, Faster, and Better Than Before

Phobos logo

Phobos is Petabridge’s application performance monitoring (APM) integration library for Akka.NET, which we released originally back in 2018. Since then it’s undergone some major changes and transformations in order to better support Akka.NET and Akka.NET users.

Short Version

  • Phobos, our Akka.NET application performance monitoring (APM) library that automatically traces and measures actor activity without requiring you to write any instrumentation code, 1.0.0 is now available.
  • It now easily integrates with non-Akka.NET technologies such as ASP.NET and works with a much larger selection of tracing and metrics APM systems than it did before.
  • Phobos now only costs $4,000 per year per organization with no limitations on the number of seats or nodes it’s installed upon.
  • You can buy Phobos instantly online via credit card at Sdkbin.
  • We offer a full 30-day money back guarantee, so if you contact us within 30 days of your purchase and are dissatisfied with your purchase we will refund you in full.
  • Each Phobos subscription comes with support provided by the Petabridge team, so if you need help installing / configuring / deploying Phobos or if it’s not capturing the data you need you can ask us to help at no additional charge.

You can learn more about Phobos at https://phobos.petabridge.com/ or buy instantly online at https://sdkbin.com/publisher/petabridge/product/phobos

What Phobos Does

Phobos is a set of properietary NuGet packages that you can install into a pre-existing Akka.NET application and automatically begin capturing operational metrics and tracing data, collectively called “telemetry” data, without needing write any APM decorator code.