-
-
Save bruinbrown/14a8fc8cfa30ef667135 to your computer and use it in GitHub Desktop.
An example of using Ask in Akka.Net with Web API
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
public async Task<List<string>> RegisteredUsers(string serviceId) | |
{ | |
var system = Global.System; | |
var serviceActorAddress = String.Format("/user/service/{0}", serviceId); | |
var resp = await system.ActorSelection(serviceActorAddress).Ask(RegisteredUsersRequest.Instance); | |
return resp; | |
} |
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
public class ServiceActor : UntypedActor | |
{ | |
List<string> _registeredUsers = new List<string>(); | |
protected override void OnReceive(object message) | |
{ | |
if(message is RegisteredUsersRequest) | |
{ | |
Sender.Tell(_registeredUsers); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment