Created
June 24, 2015 13:07
-
-
Save Horusiath/e860791d298874f0f7db to your computer and use it in GitHub Desktop.
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 Guest : ReceiveActor | |
{ | |
public Guest() | |
{ | |
Receive<Badge>(badge => | |
{ | |
// ... do something with received badge | |
}); | |
// it would be better to expose some kind of "address book" actor, | |
// that returns actor refs for keys on demand | |
Context.ActorSelection("/user/Klara").Tell(new BadgeRequest { Name = Self.Path.Name, LicensePlate = "AAA111" }); | |
} | |
} | |
public class Receptionist : ReceiveActor | |
{ | |
public Receptionist() | |
{ | |
Receive<BadgeRequest>(badgeRequest => | |
{ | |
var badge = new Badge | |
{ | |
Id = Guid.NewGuid(), | |
Name = badgeRequest.Name, | |
ValableOn = DateTime.Now, | |
DeliveredBy = Self.Path.Name | |
}; | |
Sender.Tell(badge); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment