Ejemplo n.º 1
0
        public async Task ReceiveReminderAsync(string reminderName, byte[] state, TimeSpan dueTime, TimeSpan period)
        {
            try
            {
                EntitySecret entitySecret = await RetrieveEntityMediaAsync().ConfigureAwait(false);

                WriteTimedDebug($"Ticket download complete: {entitySecret.ValidationLicenseCode}");

                await CallEntityReceivedAsync(entitySecret);

                Guid sourceActorId = await StateManager.GetStateAsync <Guid>(ConsumerRefIdKey);

                Uri sourceServiceUri = await StateManager.GetStateAsync <Uri>(SourceServiceUriKey);

                if (sourceServiceUri == ConsumerServiceUri)
                {
                    IConsumerSimulationActor consumerActor = ActorProxy.Create <IConsumerSimulationActor>(new ActorId(sourceActorId), sourceServiceUri);

                    await consumerActor.UpdateDownloadStatusAsync(entitySecret);
                }

                else
                {
                    IConsumerExchangeActor exchangeActor = ActorProxy.Create <IConsumerExchangeActor>(new ActorId(sourceActorId), sourceServiceUri);

                    await exchangeActor.UpdateDownloadStatusAsync(entitySecret);
                }

                var reminder = GetReminder(ReminderKey);

                await UnregisterReminderAsync(reminder).ConfigureAwait(false);
            }

            catch (Exception ex)
            {
                WriteTimedDebug(ex);
            }
        }