private void DoParser(IActor anActor) { List <String> aList = new List <String>(); aList.Add(ActorTask.Stat()); var lParser = new ParserActor(); lParser.SendMessage(aList.AsEnumerable <String>(), anActor); }
private void DoParser() { List <String> aList = new List <String>(); aList.Add(ActorTask.Stat()); var lParser = new ParserActor(); new EchoActor <IEnumerable <string> >(lParser, aList); lParser.SendMessage(aList.AsEnumerable <String>()); }
protected override void OnStartup(StartupEventArgs e) { GUID = GetGUID(); _mtx = new Mutex(true, GUID, out var mtxSuccess); // 뮤텍스를 얻지 못하면 에러 if (!mtxSuccess) { MessageBox.Show("이미 실행중입니다."); Shutdown(); return; } try { var authority = AkkaHelper.ReadConfigurationFromHoconFile(Assembly.GetExecutingAssembly(), "conf") .WithFallback(ConfigurationFactory .FromResource <ConsumerSettings <object, object> >("Akka.Streams.Kafka.reference.conf")) .GetInt("ui.notification.authority-level"); if (authority < 1 || authority > 5) { MessageBox.Show("authority-level은 1~5까지 지정할 수 있습니다.", "Error"); Shutdown(); return; } var assembly = Assembly.GetExecutingAssembly(); var fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location); _version = fileVersionInfo.ProductVersion; var config = AkkaHelper.ReadConfigurationFromHoconFile(Assembly.GetExecutingAssembly(), "conf") .WithFallback(ConfigurationFactory.FromResource <ConsumerSettings <object, object> >("Akka.Streams.Kafka.reference.conf")); CreateTrayIcon(config); CreateNotifier(config); var system = ActorSystem.Create("BLUECATS-ToastNotifier", config); notificationActor = system.ActorOf(NotificationActor.Props(Notifier), nameof(NotificationActor)); var parserActor = system.ActorOf(ParserActor.Props(notificationActor), nameof(ParserActor)); var eventSubscribeActor = system.ActorOf(EventSubscribeActor.Props(notificationActor), nameof(EventSubscribeActor)); system.EventStream.Subscribe(eventSubscribeActor, typeof(Akka.Event.Error)); var bootStrapServers = GetBootStrapServers(config); var consumerSettings = ConsumerSettings <Null, string> .Create(system, null, Deserializers.Utf8) .WithBootstrapServers(bootStrapServers) .WithGroupId(GUID); notificationActor.Tell((NotificationLevel.Info, $"BLUE CATS: Client Start\n{GUID}")); RestartSource.WithBackoff(() => KafkaConsumer.PlainSource(consumerSettings, GetSubscription(config)), minBackoff: TimeSpan.FromSeconds(3), maxBackoff: TimeSpan.FromSeconds(30), randomFactor: 0.2) .RunForeach(result => { parserActor.Tell(result); }, system.Materializer()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); Current.Shutdown(); } base.OnStartup(e); }