コード例 #1
0
ファイル: PluginSystem.cs プロジェクト: y4k/AkkaLibrary
        private bool ValidateConfiguration <TPluginType>(BasePluginConfiguration <TPluginType> config) where TPluginType : BasePluginActor <TPluginType>, new()
        {
            var errors = new List <string>();

            if (string.IsNullOrEmpty(config.Name))
            {
                errors.Add($"Name must not be null or empty.");
            }

            return(errors.Count > 0 ? true : false);
        }
コード例 #2
0
ファイル: PluginSystem.cs プロジェクト: y4k/AkkaLibrary
        public IActorRef CreatePlugin <TPluginType>(BasePluginConfiguration <TPluginType> configuration) where TPluginType : BasePluginActor <TPluginType>, new()
        {
            var props = PluginSupervisorActor <TPluginType> .GetProps(configuration, PluginRegistryRef);

            var name = $"{configuration.Name}-plugin-supervisor";

            var pluginSupervisor = System.ActorOf(props, name);

            pluginSupervisor.Tell(new PluginSupervisorMessages.PluginStart());

            return(pluginSupervisor);
        }
コード例 #3
0
        public PluginSupervisorActor(BasePluginConfiguration <TPluginType> pluginConfig, IActorRef registry)
        {
            _inputs           = new Dictionary <string, Type>();
            _outputs          = new Dictionary <string, Type>();
            _subscriberRefs   = new Dictionary <string, IActorRef>();
            _subscriberTopics = new Dictionary <string, IEnumerable <string> >();

            _pluginProps  = Props.Create(() => new TPluginType());
            _pluginConfig = pluginConfig;

            _registry = registry;
            _name     = Context.Self.Path.Name;

            _logger = Context.WithIdentity("PluginSupervisor");

            Ready();
        }
コード例 #4
0
 public static Props GetProps(BasePluginConfiguration <TPluginType> configuration, IActorRef registry)
 {
     return(Props.Create(() => new PluginSupervisorActor <TPluginType>(configuration, registry)));
 }
コード例 #5
0
 public Configure(BasePluginConfiguration <TPluginType> configuration)
 {
 }