public ProcessStatistics() { var clt = new ClientStartup(); _client = clt.StartClientWithRetriesSync(); _addStatisticsGrainPool = new GrainsManageStatisticsPool <MonitoredProcess>(_client, 100); }
public async Task <double> RunMainAsync() { Thread.Sleep(5000); var clt = new ClientStartup(); using (var client = await clt.StartClientWithRetries()) { var rand = new Random(DateTime.Now.Millisecond); // var addStatisticsGrain = client.AddStatisticsGrain<Student>(); var grainsExecutivePool = new GrainsExecutivePool(client, 1); await grainsExecutivePool.LoadAssembly(typeof(RemoteExecutionTest)); var context = new GenericGrainsContext(); context.SetValue("Add", 1000); for (int i = 0; i < 30000; ++i) { var ret = await grainsExecutivePool.ExecuteWithContext <decimal>(nameof(RemoteExecutionTest), nameof(RemoteTestClass.RemoteExecutionTest.PowN), context, (decimal)3, (decimal)i); Console.WriteLine($"RET: {ret}"); } Console.ReadKey(); return(0); } }
private static void SetFreeEvent() { $dllname$.$serviceclassname$.Client.ExcetinedEvent += (method, clinet) => { ClientStartup.SetFree(typeof(Client), clinet); }; }
public MeanTemperatureValues(OnlineMeteoStatisticsSettings settings) : base(settings.SchedulerSettings) { var clt = new ClientStartup(); _client = clt.StartClientWithRetriesSync(); _addDevicesGrainPool = new GrainsManageStatisticsPool <DeviceMeanValues>(_client, 10); _getStatisticsGrainPool = new GrainsGetStatisticsPool <DeviceValues>(_client, 10); }
public NarodMonPolling(OnlineMeteoStatisticsSettings settings, IHttpClientFactory httpClientFactory) { _httpClientFactory = httpClientFactory; var clt = new ClientStartup(); _client = clt.StartClientWithRetriesSync(); _settings = settings; _addStatisticsGrainPool = new GrainsManageStatisticsPool <DeviceValues>(_client, 10); _addDevicesGrainPool = new GrainsManageStatisticsPool <Device>(_client, 3); _getDevicesGrainPool = new GrainsGetStatisticsPool <DeviceValues>(_client, 3); }
public async Task <int> RunMainAsync() { try { //#if DEBUG // Thread.Sleep(10000); //#endif var clt = new ClientStartup(); using (var client = await clt.StartClientWithRetries()) { var rand = new Random(DateTime.Now.Millisecond); // var addStatisticsGrain = client.AddStatisticsGrain<Student>(); var addStatisticsGrainPool = new GrainsManageStatisticsPool <Student>(client, 150); var cleanCount = await addStatisticsGrainPool.Clean(); Console.WriteLine($"DEL RESULT: {cleanCount}"); Console.ReadKey(); for (int i = 0; i < 1000000; ++i) { var stud = new Student() { Name = "Ivan", Surname = "Petrov", Birthdate = DateTime.UtcNow.AddYears(-18 - rand.Next() % 15) }; await addStatisticsGrainPool.Put(stud); // Console.WriteLine($"student: {JsonConvert.SerializeObject(stud)}"); } Console.WriteLine("Data was added... Getting statistics..."); //var getStatisticsGrain = client.GetStatisticsGrain<Student>(); var getStatisticsGrainPool = new GrainsGetStatisticsPool <Student>(client, 30); var stat = await getStatisticsGrainPool.Get(t => t.Birthdate.Date.Year == 2000); Console.WriteLine($"Data result : {stat.Count} students were born in 2000!"); Console.WriteLine($"======================================================"); Console.ReadKey(); } return(0); } catch (Exception e) { Console.WriteLine(e); Console.ReadKey(); return(1); } }
public void ConfigureServices(IServiceCollection services) { ClientStartup.ConfigureServices(services, GetBaseUrl(), true); services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); services.AddDbContext <ConferencesDbContext>( options => options.UseInMemoryDatabase(databaseName: "BlazorWasmPrerendering")); services.AddCodeFirstGrpc(config => { config.ResponseCompressionLevel = System.IO.Compression.CompressionLevel.Optimal; }); services.AddControllersWithViews(); services.AddRazorPages(); }