public async Task ReceiveReminderAsync(string reminderName, byte[] context, TimeSpan dueTime, TimeSpan period)
{
switch (reminderName)
{
case CustomerOrderReminderNames.FulfillOrderReminder:
await this.FulfillOrderAsync();
CustomerOrderStatus orderStatus = await this.GetOrderStatusAsync();
if (orderStatus == CustomerOrderStatus.Shipped || orderStatus == CustomerOrderStatus.Canceled)
{
//Remove fulfill order reminder so Actor can be gargabe collected.
IActorReminder orderReminder = this.GetReminder(CustomerOrderReminderNames.FulfillOrderReminder);
await this.UnregisterReminderAsync(orderReminder);
}
break;
default:
// We should never arrive here normally. The system won't call reminders that don't exist.
// But for our own sake in case we add a new reminder somewhere and forget to handle it, this will remind us.
throw new InvalidOperationException("Unknown reminder: " + reminderName);
}
}