Skip to content

Instantly share code, notes, and snippets.

@Horusiath
Created June 24, 2015 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Horusiath/e860791d298874f0f7db to your computer and use it in GitHub Desktop.
Save Horusiath/e860791d298874f0f7db to your computer and use it in GitHub Desktop.
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