-
-
Save shersh/2dd43ac70ff95e20ed4c1e4b2f87b38c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var system = ActorSystem.Create("TestSystem"); | |
var myActor = system.ActorOf(Props.Create(() => new MyActor()); | |
using (var materializer = system.Materializer()) | |
{ | |
var source = Source.From(Enumerable.Range(1, 100)); | |
//var sink = Sink.ForEach<int>(x => tcpActor.Tell(x)); | |
var sink = Sink.ActorRef<int>(tcpActor, "Done"); | |
var runnable = source.ToMaterialized(sink, Keep.Both); | |
runnable.Run(materializer); | |
} | |
Console.ReadLine(); | |
} | |
} | |
public class MyActor : ReceiveActor | |
{ | |
public MyActor() | |
{ | |
Receive<string>(s => Console.WriteLine(s)); | |
Receive<int>(i => Console.WriteLine("Got int: " + i)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment