Created
May 25, 2019 07:58
-
-
Save karthik20522/c5e54ff3f88fa1456a1acd22f68b074a to your computer and use it in GitHub Desktop.
Akka.net
This file contains hidden or 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
public class ImagePersistanceActor: ReceiveActor, ILogReceive { | |
public ImagePersistanceActor() { | |
Receive < string > (message => { | |
Console.WriteLine("Echo from Recieve actor: " + message); | |
}); | |
Receive < Image > (image => { | |
Console.WriteLine("OK form Receive Actor: " + image.Id); | |
}); | |
} | |
} | |
public class ImagePersistanceActor2: TypedActor, IHandle < string > , IHandle < Image > { | |
public void Handle(string message) { | |
Console.WriteLine("Echo From typed actor: " + message); | |
} | |
public void Handle(Image image) { | |
Console.WriteLine("OK form Typed Actor: " + image.Id); | |
} | |
} | |
public class ImagePersistanceActor3: UntypedActor { | |
protected override void OnReceive(object message) { | |
if (message.GetType() == typeof(string)) { | |
Console.WriteLine("Echo from Untyped Actor: " + message); | |
} else if (message.GetType() == typeof(Image)) { | |
var image = (Image) message; | |
Console.WriteLine("OK form untyped Actor: " + image.Id); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment