public bool Start() { var config = HoconLoader.ParseConfig("crawler.hocon"); ClusterSystem = ActorSystem.Create("webcrawler", config.BootstrapFromDocker()); return(true); }
public void Start() { try { var huconConfig = Path.Combine(Directory.GetCurrentDirectory(), EnvSettings.Instance().HuconFileName); var config = HoconLoader.FromFile(huconConfig); ActorSystemInstance = ActorSystem.Create(EnvSettings.Instance().ActorSystem, config); IMemberRepository memberRepository = new MockMemberRepository(); ICommonStockRepository commonStockRepository = new MockCommonStockRepository(); ICommonStockInfoRepository commonStockInfoRepository = new MockCommonStockInfoRepository(); IEodRepository eodRepository = new MockEodRepository(); //IBatchPublisher batchPublisher = new BatchPublisher(new Uri(EnvSettings.Instance().BatchUrl)); var memberController = MemberActorProvider.CreateInstance(ActorSystemInstance, memberRepository); //var jobsActorProvider = JobsActorProvider.CreateInstance(ActorSystemInstance, batchPublisher); //var backLogsActor = BackLogsActorProvider.CreateInstance(ActorSystemInstance, new JobsActorProvider(ActorSystemInstance, EnvSettings.Instance().AkkaAddress)); var commonStocksActor = CommonStocksProvider.CreateInstance(ActorSystemInstance, commonStockRepository, commonStockInfoRepository); var eodStocksActor = EodStocksProvider.CreateInstance(ActorSystemInstance, eodRepository); var commonStockRouteActor = CommonStockRouteProvider.CreateInstance(ActorSystemInstance, commonStocksActor, eodStocksActor); } catch (Exception ex) { throw ex; } }
public static void AddActorSystem(this IServiceCollection services) { string host = EnvSettings.Instance().AkkaAddress; var huconConfig = Path.Combine(Directory.GetCurrentDirectory(), EnvSettings.Instance().HuconFileName); var config = HoconLoader.FromFile(huconConfig); var actorSystem = ActorSystem.Create(EnvSettings.Instance().ActorSystem, config); var memberActorProvider = new MemberActorProvider(actorSystem, host); //var backLogsActorProvider = new BackLogsActorProvider(actorSystem, host); //var jobsActorProvider = new JobsActorProvider(actorSystem, host); var commonStocksProvider = new CommonStocksProvider(actorSystem, host); var eodStocksProvider = new EodStocksProvider(actorSystem, host); var commonStockRouteProvider = new CommonStockRouteProvider(actorSystem, host); services.AddSingleton(typeof(ActorSystem), actorSystem); services.AddSingleton <MemberActorProvider>(_ => memberActorProvider); //services.AddSingleton<BackLogsActorProvider>(_ => backLogsActorProvider); //services.AddSingleton<JobsActorProvider>(_ => jobsActorProvider); services.AddSingleton <CommonStocksProvider>(_ => commonStocksProvider); services.AddSingleton <EodStocksProvider>(_ => eodStocksProvider); services.AddSingleton <CommonStockRouteProvider>(_ => commonStockRouteProvider); services.AddMemberServices(); //services.AddJobServices(); //services.AddBackLogServices(); services.AddCommonStockServices(); }
public Task StartAsync(CancellationToken cancellationToken) { var actorSystemConfig = HoconLoader.FromFile("./akka.hocon"); ActorSystem = ActorSystem.Create("core-wars", actorSystemConfig); var scriptRepositoryProps = Data.ScriptRepository.Props(_container.Resolve <IDataContext>()); ScriptRepository = ActorSystem.ActorOf(scriptRepositoryProps); var statsRepositoryProps = Props.Create(() => new StatsRepository(_container.Resolve <IDataContext>())); ResultsHandler = ActorSystem.ActorOf(statsRepositoryProps); RegisterNotifications(); CompetitorFactory = _container.Resolve <AggregatedCompetitorFactory>(); var competitorRootProps = Props.Create(() => new CompetitorsRoot(ScriptRepository, CompetitorFactory, ResultsHandler)); CompetitorsRoot = ActorSystem.ActorOf(competitorRootProps, "competitors"); InitializeCompetitions(); return(Task.CompletedTask); }
public bool Start() { var config = HoconLoader.ParseConfig("crawler.hocon"); ClusterSystem = ActorSystem.Create("webcrawler", config.ApplyOpsConfig()).StartPbm(); return(true); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddSingleton(provider => { var serviceScopeFactory = provider.GetService <IServiceScopeFactory>(); var hocon = HoconLoader.FromFile("akka.net.hocon"); var actorSystem = ActorSystem.Create("calculationengine", hocon); actorSystem.AddServiceScopeFactory(serviceScopeFactory); return(actorSystem); }); services.AddEventStore(o => o.WithGES(Configuration.GetConnectionString("EventStore"), "admin", "changeit")); services.AddEfCore <AkkaPersistenceContext>(Configuration.GetConnectionString("SqlServer")); services.AddLogging(); services.AddScoped(x => { var logger = x.GetService <ILogger>(); var system = x.GetService <ActorSystem>(); var actor = system.ActorOf <CalculationEngineActor>(); return(new AkkaEventBus(actor).WithLogging()); }); services.AddSingleton(Configuration); }
public Task StartAsync(CancellationToken cancellationToken) { var config = HoconLoader.ParseConfig("tracker.hocon"); var bootstrap = BootstrapSetup.Create() .WithConfig(config.ApplyOpsConfig()) // load HOCON and apply extension methods to inject environment variables .WithActorRefProvider(ProviderSelection.Cluster.Instance); // launch Akka.Cluster // N.B. `WithActorRefProvider` isn't actually needed here - the HOCON file already specifies Akka.Cluster // enable DI support inside this ActorSystem, if needed var diSetup = ServiceProviderSetup.Create(_serviceProvider); // merge this setup (and any others) together into ActorSystemSetup var actorSystemSetup = bootstrap.And(diSetup); // start ActorSystem ClusterSystem = ActorSystem.Create("webcrawler", actorSystemSetup); ClusterSystem.StartPbm(); // start Petabridge.Cmd (https://cmd.petabridge.com/) // instantiate actors _apiMaster = ClusterSystem.ActorOf(Props.Create(() => new ApiMaster()), "api"); _downloadMaster = ClusterSystem.ActorOf(Props.Create(() => new DownloadsMaster()), "downloads"); return(Task.CompletedTask); }
public Task StartAsync(CancellationToken cancellationToken) { var config = HoconLoader.ParseConfig("web.hocon"); var bootstrap = BootstrapSetup.Create() .WithConfig(config.ApplyOpsConfig()) // load HOCON and apply extension methods to inject environment variables .WithActorRefProvider(ProviderSelection.Cluster.Instance); // launch Akka.Cluster // N.B. `WithActorRefProvider` isn't actually needed here - the HOCON file already specifies Akka.Cluster // enable DI support inside this ActorSystem, if needed var diSetup = ServiceProviderSetup.Create(_serviceProvider); // merge this setup (and any others) together into ActorSystemSetup var actorSystemSetup = bootstrap.And(diSetup); // start ActorSystem _clusterSystem = ActorSystem.Create("webcrawler", actorSystemSetup); _clusterSystem.StartPbm(); // start Petabridge.Cmd (https://cmd.petabridge.com/) // instantiate actors var router = _clusterSystem.ActorOf(Props.Empty.WithRouter(FromConfig.Instance), "tasker"); var processor = _clusterSystem.ActorOf( Props.Create(() => new CommandProcessor(router)), "commands"); var signalRProps = ServiceProvider.For(_clusterSystem).Props <SignalRActor>(processor); _signalRActor = _clusterSystem.ActorOf(signalRProps, "signalr"); return(Task.CompletedTask); }
public void ConfigureServices(IServiceCollection services) { services.AddMvcCore() .AddApiExplorer() .AddJsonFormatters(delegate(JsonSerializerSettings settings) { settings.DateFormatHandling = DateFormatHandling.IsoDateFormat; settings.Error = (sender, args) => { var logger = LoggerFactoryManager.GetLogger <JsonSerializerSettings>(); var objectName = args.CurrentObject?.GetType().FullName ?? "Unknown"; logger.LogWarning($"Failed to deserialize [{objectName}] JSON on input: {args.ErrorContext.Error.Message}"); }; }); // Add the config services.AddSingleton(Program.AppConfig); // Create the actor system services.AddSingleton(_ => { // Simple solution to inject our logger LoggerFactoryManager.Init(_); return(ActorSystem.Create("faresandticketing", HoconLoader.FromFile(Path.Combine(Directory.GetCurrentDirectory(), HoconFileName)))); }); // Add the ES client implementation //services.AddSingleton<IESClient, ESClient>(_ => new ESClient(_.GetRequiredService<ILogger<ESClient>>(), _.GetRequiredService<AppConfig>())); services.AddFareServices(); services.AddSwaggerGen(c => c.SwaggerDoc("v1", new Info { Title = "Quote Validator V1", Version = "v1" })); }
public bool Start() { var config = HoconLoader.ParseConfig("timecardserviceconfig.hocon"); ClusterSystem = ActorSystem.Create("LetsTalk-system", config.BootstrapFromDocker()); CreateActors(); return(true); }
static void Main(string[] args) { var hocon = HoconLoader.FromFile("akka.net.hocon"); var system = ActorSystem.Create("GameManagementClient", hocon); // SwitchToChat(system); SwitchToGame(system); }
public void ConfigureServices(IServiceCollection services) { var hocon = HoconLoader.FromFile("akka.net.hocon"); var actorSystem = ActorSystem.Create("calculator-actor-system", hocon); services.AddSingleton(typeof(ActorSystem), (serviceProvider) => actorSystem); services.AddSingleton(typeof(ICalculatorActorInstance), typeof(CalculatorActorInstance)); services.AddMvc(); }
public bool Start() { var config = HoconLoader.ParseConfig("tracker.hocon"); ClusterSystem = ActorSystem.Create("webcrawler", config.BootstrapFromDocker()); ApiMaster = ClusterSystem.ActorOf(Props.Create(() => new ApiMaster()), "api"); DownloadMaster = ClusterSystem.ActorOf(Props.Create(() => new DownloadsMaster()), "downloads"); return(true); }
static void Main(string[] args) { var hocon = HoconLoader.FromFile("akka.net.hocon"); ActorSystem system = ActorSystem.Create("server-system", hocon); Console.WriteLine("Server started"); Console.Read(); system.Terminate().Wait(); }
public bool Start() { var config = HoconLoader.ParseConfig(CommonNames.PingHocon); ClusterSystem = ActorSystem.Create(CommonNames.ActorSystemName, ActorPaths.PingActorMetaData.Config); _pingCoordinatorActor = ClusterSystem.ActorOf(PingCoordinatorActor.Props(), ActorPaths.PingActorMetaData.Name); _arpActor = ClusterSystem.ActorOf(Props.Create(() => new ArpActor(_pingCoordinatorActor)), ActorPaths.ArpActorMetaData.Name); return(true); }
public bool Start() { var config = HoconLoader.ParseConfig(CommonNames.WriterHocon); ClusterSystem = ActorSystem.Create(CommonNames.ActorSystemName, config); var _actor = ClusterSystem.ActorOf(WriterActor.Props(), CommonNames.Writer); _actor.Tell("Writer is starting work !!!"); return(true); }
static void Main(string[] args) { var hocon = HoconLoader.FromFile("akka.net.hocon"); using (var system = ActorSystem.Create("MyServer", hocon)) { system.ActorOf <ChatServerActor>("ChatServer"); Console.WriteLine("Server is Ready!"); Console.ReadLine(); } }
public static ActorSystem StartAkka() { var config = HoconLoader.ParseConfig("web.hocon"); SystemActors.ActorSystem = ActorSystem.Create("webcrawler", config.ApplyOpsConfig()).StartPbm(); var router = SystemActors.ActorSystem.ActorOf(Props.Empty.WithRouter(FromConfig.Instance), "tasker"); var processor = SystemActors.CommandProcessor = SystemActors.ActorSystem.ActorOf(Props.Create(() => new CommandProcessor(router)), "commands"); SystemActors.SignalRActor = SystemActors.ActorSystem.ActorOf(Props.Create(() => new SignalRActor(processor)), "signalr"); return(SystemActors.ActorSystem); }
static void Main(string[] args) { System.Console.Title = "Akka Server"; var hocon = HoconLoader.FromFile("akka.net.hocon"); ActorSystem system = ActorSystem.Create("akka-server-system", hocon); system.ActorOf <AkkaServerActor>("AkkaServer"); System.Console.WriteLine("Akka.Net Server started.."); System.Console.WriteLine(); System.Console.WriteLine(); System.Console.Read(); system.Terminate().Wait(); }
static void Main(string[] args) { Console.Title = "Seed"; var config = HoconLoader.ParseDefaultConfig().WithFallback(DistributedPubSub.DefaultConfig()); var system = ActorSystem.Create("mirerosystem", config); //system.UseSerilog(); DistributedPubSub.Get(system); // --> DistributedPubsub이 만들어진다. system.Run(); }
public static ActorSystem StartAkka() { // Akka.NET var hocon = HoconLoader.FromFile("akka.net.hocon"); SystemActors.ActorSystem = ActorSystem.Create("MiniSportsbook", hocon); SystemActors.CommandProcessor = SystemActors.ActorSystem.ActorOf(Props.Create(() => new FrontendServerActor()), "FrontendServerActor"); SystemActors.SignalRActor = SystemActors.ActorSystem.ActorOf(Props.Create(() => new SignalRActor()), "SignalRActor"); return(SystemActors.ActorSystem); }
public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); var config = HoconLoader.ParseConfig("akka.hocon"); ActorSystemRefs.ActorSystem = ActorSystem.Create("Frontend", config); ActorSystemRefs.Coordinator = ActorSystemRefs.ActorSystem.ActorSelection(Configuration.GetValue <string>("CoordinatorAddress")); }
static void Main(string[] args) { var hocon = HoconLoader.FromFile("akka.net.hocon"); using (var system = ActorSystem.Create("MyClient", hocon)) { var chatClient = system.ActorOf(Props.Create <ChatClientActor>()); chatClient.Tell(new ConnectRequest() { Username = "******", }); while (true) { var input = Console.ReadLine(); if (input.StartsWith("/")) { var parts = input.Split(' '); var cmd = parts[0].ToLowerInvariant(); var rest = string.Join(" ", parts.Skip(1)); if (cmd == "/nick") { chatClient.Tell(new NickRequest { NewUsername = rest }); } if (cmd == "/exit") { Console.WriteLine("exiting"); break; } } else { chatClient.Tell(new SayRequest() { Text = input, }); } } system.Terminate().Wait(); } }
static void Main(string[] args) { Console.Title = "DistributePubSub.JobHandler"; //var config = DistributedPubSub.DefaultConfig().WithFallback(HoconLoader.ParseDefaultConfig()); var config = HoconLoader.ParseDefaultConfig().WithFallback(DistributedPubSub.DefaultConfig()); var system = ActorSystem.Create("mirerosystem", config); //system.UseSerilog(); //Console.WriteLine(system.Settings.Config.GetConfig("akka.actor.serializers")); //Console.WriteLine("Press any key to continue"); //Console.ReadLine(); var echo = system.ActorOf(Props.Create(() => new JobHandlerActor()), "handler"); echo.Tell(new object()); system.Run(); }
public static ActorSystem StartAkka() { var config = HoconLoader.ParseConfig("web.hocon"); SystemActors.ActorSystem = ActorSystem.Create("webcrawler", config.BootstrapFromDocker()); var router = SystemActors.ActorSystem.ActorOf(Props.Empty.WithRouter(FromConfig.Instance), "tasker"); var processor = SystemActors.CommandProcessor = SystemActors.ActorSystem.ActorOf(Props.Create(() => new CommandProcessor(router)), "commands"); SystemActors.SignalRActors = new List <IActorRef>() { SystemActors.ActorSystem.ActorOf(Props.Create(() => new SignalRActor(processor)), "signalr0"), SystemActors.ActorSystem.ActorOf(Props.Create(() => new SignalRActor(processor)), "signalr1"), SystemActors.ActorSystem.ActorOf(Props.Create(() => new SignalRActor(processor)), "signalr2"), SystemActors.ActorSystem.ActorOf(Props.Create(() => new SignalRActor(processor)), "signalr3"), SystemActors.ActorSystem.ActorOf(Props.Create(() => new SignalRActor(processor)), "signalr4") }; return(SystemActors.ActorSystem); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { //AKKANET Configuration var hocon = HoconLoader.FromFile("akka.net.hocon"); var actorSystem = ActorSystem.Create("MyClient", hocon); var avsClient = actorSystem.ActorOf(Props.Create <AkkaClientActor>()); avsClient.Tell(new ConnectRequest() { Username = "******", }); services.AddSingleton(typeof(ActorSystem), (serviceProvider) => actorSystem); //services.AddSingleton(typeof(IMessageActorInstance), typeof(MessageActorInstance)); //AKKANET Configuration end. services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
public bool Start() { PreStart(); // create actor system ClusterConfig = HoconLoader.ParseConfig(HoconPath).WithPortFromEnvironmentVariable(); ClusterSystem = ActorSystem.Create(ClusterName, ClusterConfig); var cluster = Cluster.Get(ClusterSystem); // call PostStart only after joined cluster successfully cluster.RegisterOnMemberUp(() => PostStart()); // aggressive solution: call Stop immediately when left cluster cluster.RegisterOnMemberRemoved(() => { Console.WriteLine($"Current member is removed from cluster, member info: {cluster.SelfMember}"); Stop(); }); return(true); }
public static IServiceCollection AddAkkaService(this IServiceCollection services, string configfile, bool isdocker = false) { var config = HoconLoader.ParseConfig(configfile); if (isdocker) { config = config.BootstrapFromDocker(); } services.AddSingleton(provider => { var bootstrap = BootstrapSetup.Create().WithConfig(config); var di = ServiceProviderSetup.Create(provider); var actorSystemSetup = bootstrap.And(di); return(ActorSystem.Create(config.GetString("akka.MaserServer"), actorSystemSetup).StartPbm()); }); return(services); }
static void Main(string[] args) { Console.Title = "DistributePubSub.JobRequester"; var config = HoconLoader.ParseDefaultConfig().WithFallback(DistributedPubSub.DefaultConfig()); var system = ActorSystem.Create("mirerosystem", config); var generator = system.ActorOf(Props.Create <JobRequesterActor>(), "distributor"); system.Run(wait: false); Console.WriteLine("any alphabet will be published in 1-to-n way"); Console.WriteLine("any number will be published in 1-to-1 way"); Console.WriteLine("'q' to quit..."); var input = Console.ReadLine(); while (input != "q") { var job = new RequestJob(input); generator.Tell(job); input = Console.ReadLine(); } }
private void LoadConfig() { this.config = HoconLoader.ParseConfig(this.systemConfig.SystemHoconConfigPath); }