mailwal

Async / Await vs. PipeTo - Dealing with Tasks and Akka.NET Actors

Petabridge
Petabridge - the Akka.NET Company

Async / Await vs. PipeTo in Akka.NET Actors

Hello Mailwal - we thought you might like this!

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

Akka.NET actors natively support async and awaiting on Tasks internally, such as the sample below:

Akka.NET ReceiveActor using async / await during processing.
Akka.NET ReceiveActor using async / await during processing.

However, Akka.NET also includes an extension method for Task<T>s called "PipeTo<T>" which makes it possible to forward the results of any complete task back into the actor's mailbox as a message.

This option allows for non-blocking, out-of-band processing to occur - meaning that the actor can continue to do.

So when should you use each? Read on to find out.

Like Akka.NET? Give us a star on GitHub.

While we appreciate purchases and support plans, liking our open source work on GitHub helps give users more confidence to try Akka.NET.

youtubegithubx-twitterlinkedinfacebook