Skip to content

Instantly share code, notes, and snippets.

@tomliversidge
Created June 24, 2017 13:11
Show Gist options
  • Save tomliversidge/c3bb87126c3d079afa3e45babe4a4de6 to your computer and use it in GitHub Desktop.
Save tomliversidge/c3bb87126c3d079afa3e45babe4a4de6 to your computer and use it in GitHub Desktop.
Saga 2.1
public Task ReceiveAsync(IContext context)
{
switch (context.Message)
{
// ...
case Credit msg:
return AdjustBalance(msg.ReplyTo, msg.Amount);
case Debit msg when msg.Amount + _balance >= 0:
return AdjustBalance(msg.ReplyTo, msg.Amount);
// ...
}
return Actor.Done;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment