Esempio n. 1
0
 /// <summary>
 /// Registers the<paramref name="supervisorClass"/> plugin by <paramref name="name"/> that will supervise all <c>Actor</c> that implement the <paramref name="supervisedProtocol"/>.
 /// </summary>
 /// <param name="stageName">The <c>string</c> of the <c>Stage</c> in which the <paramref name="supervisorClass"/> is be registered.</param>
 /// <param name="name">The <c>string</c> name of the supervisor to register.</param>
 /// <param name="supervisedProtocol">The protocol for which the supervisor will supervise.</param>
 /// <param name="supervisorClass">The <c>Type</c> (which should be a subclass of <c>Actor</c>) to register as a supervisor.</param>
 public void RegisterCommonSupervisor(string stageName, string name, Type supervisedProtocol, Type supervisorClass)
 {
     try
     {
         var actualStageName = stageName.Equals("default") ? DefaultStage : stageName;
         var stage           = StageNamed(actualStageName);
         var common          = stage.ActorFor <ISupervisor>(Definition.Has(supervisorClass, Definition.NoParameters, name));
         stage.RegisterCommonSupervisor(supervisedProtocol, common);
     }
     catch (Exception e)
     {
         DefaultLogger.Log($"vlingo-net/actors: World cannot register common supervisor: {supervisedProtocol.Name}", e);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Registers the <paramref name="supervisorClass"/> plugin by <paramref name="name"/> that will serve as the default supervise for all <c>Actor</c>
 /// that are not supervised by a specific supervisor.
 /// </summary>
 /// <param name="stageName">The <c>string</c> of the <c>Stage</c> in which the <paramref name="supervisorClass"/> is be registered.</param>
 /// <param name="name">The <c>string</c> name of the supervisor to register.</param>
 /// <param name="supervisorClass">The <c>Type</c> (which should be a subclass of <c>Actor</c>) to register as a supervisor.</param>
 public void RegisterDefaultSupervisor(string stageName, string name, Type supervisorClass)
 {
     try
     {
         var actualStageName = stageName.Equals("default") ? DefaultStage : stageName;
         var stage           = StageNamed(actualStageName);
         defaultSupervisor = stage.ActorFor <ISupervisor>(Definition.Has(supervisorClass, Definition.NoParameters, name));
     }
     catch (Exception e)
     {
         DefaultLogger.Log($"vlingo-net/actors: World cannot register default supervisor override: {supervisorClass.Name}", e);
         Console.WriteLine(e.Message);
         Console.WriteLine(e.StackTrace);
     }
 }