Created
June 24, 2017 13:59
-
-
Save tomliversidge/01115bc231d1426b2b4af3270daed0bc to your computer and use it in GitHub Desktop.
Saga 4.2
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
private readonly Dictionary<PID, object> _processedMessages = new Dictionary<PID, object>(); | |
public Task ReceiveAsync(IContext context) | |
{ | |
switch (context.Message) | |
{ | |
case Credit msg when _processedMessages.ContainsKey(msg.ReplyTo): | |
replyTo.Tell(_processedMessages[replyTo]); | |
return Actor.Done; | |
case Credit msg: | |
_balance += amount; | |
_processedMessages.Add(replyTo, new OK()); | |
replyTo.Tell(new OK()); | |
return Actor.Done; | |
//... | |
} | |
return Actor.Done; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment