Esempio n. 1
0
 public void AddTaskHandler(TaskHandlerDescriptor taskHandlerDescriptor)
 {
     try
     {
         var handlerInstance = Activator.CreateInstance(taskHandlerDescriptor.HandlerType);
         _resolvers.Add(new MethodCallResolver(handlerInstance, taskHandlerDescriptor.EndPointPrefix));
     }
     catch (System.Exception ex)
     {
         Logger.Instance.Error(ex);
     }
 }
Esempio n. 2
0
 public void Reload(TaskHandlerDescriptor[] handlerDescriptors)
 {
     foreach (var service in _services)
     {
         var worker = service as Worker;
         if (worker != null)
         {
             try
             {
                 worker.BeginSuspend();
                 worker.RemoveAllResolvers();
                 foreach (var ht in handlerDescriptors)
                 {
                     worker.AddTaskHandler(ht);
                 }
             }
             finally
             {
                 worker.EndSuspend();
             }
         }
     }
 }