예제 #1
0
 private static void ExecuteAsync(INotificationProvider notifications, Type workerType, QueueMessage message, IQueueProvider provider)
 {
     BeltzWorker worker = null;
     var success = false;
     try
     {
         worker = (BeltzWorker)Activator.CreateInstance(workerType);
         worker.Execute(provider, message);
         success = true;
     }
     catch (Exception e)
     {
         notifications.OnError("Error executing worker", e);
         success = false;
     }
     finally
     {
         if (worker != null)
             worker.Dispose();
         notifications.OnWorkerEnded(message, success);
     }
 }