Skip to content

Instantly share code, notes, and snippets.

@tomliversidge
Last active April 1, 2017 19:17
Show Gist options
  • Save tomliversidge/7676f08df6fdadf9fedd5e466d9b22d1 to your computer and use it in GitHub Desktop.
Save tomliversidge/7676f08df6fdadf9fedd5e466d9b22d1 to your computer and use it in GitHub Desktop.
example actor
public async Task ReceiveAsync(IContext context)
{
switch (context.Message)
{
//...other handlers removed for brevity
case Multiply msg:
await Persistence.PersistEventAsync(new Multiplied { Amount = msg.Amount });
break;
case Multiplied msg:
_state.Value = _state.Value * msg.Amount;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment