internal new Task UnregisterReminder(IGrainReminder reminder) { return base.UnregisterReminder(reminder); }
public Task UnregisterReminder(IGrainReminder reminder) { return RuntimeClient.Current.UnregisterReminder(reminder); }
public async Task StopReminder(IGrainReminder reminder) { logger.Info("Stoping reminder (using ref) {0}.", reminder); // we dont reset counter as we want the test methods to be able to read it even after stopping the reminder await UnregisterReminder(reminder); }
Task IActorEndpointReminderService.UnregisterReminder(IGrainReminder reminder) { return UnregisterReminder(reminder); }
public Task UnregisterReminder(IGrainReminder reminder) { return(this.GrainService.UnregisterReminder(reminder)); }
public Task UnregisterReminder(IGrainReminder reminder) { return(RuntimeClient.Current.UnregisterReminder(reminder)); }
public Task UnregisterReminder(IGrainReminder reminder) { this.EnsureReminderServiceRegistered(); return(GrainService.UnregisterReminder(reminder)); }
public async Task Stop() { await UnregisterReminder(_reminder); _reminder = null; }
protected Task UnregisterReminder(IGrainReminder reminder) { return(Runtime.ReminderRegistry.UnregisterReminder(reminder)); }
static void Main(string[] args) { //本服务开放端口 int silePort = 11113; //主简仓网关端口 int gatewayPort = 30000; //主简仓开放端口 int mainSiloPort = 11111; ///定时器对象 IGrainReminder grainReminder = null; //由于向网关添加一个服务处理需要多一些时间 //所以在程序运行后马上获取服务可能会抛出获取不到的异常 //详情请看5、常见问题 var host = StartHost(silePort, gatewayPort, mainSiloPort); var client = StartClient(gatewayPort); while (true) { string ReadLine = Console.ReadLine(); if (ReadLine == "Exit") { host.Result.StopAsync().Wait(); client.Result.Close(); break; } else if (ReadLine == "Goods") { try { IGoods.IGoods goods = client.Result.GetGrain <IGoods.IGoods>(0); Console.WriteLine(goods.GetGoodsDescribe().Result); } catch (Exception e) { Console.WriteLine("服务暂时还没有启动完成 请稍后再试" + e.Message); } } else if (ReadLine == "GoodsList") { try { IGoods.IGoods goods = client.Result.GetGrain <IGoods.IGoods>(0); List <Entity.GoodsEntity> arrayList = goods.GetGoodsList().Result; Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(arrayList)); } catch (Exception e) { Console.WriteLine("服务暂时还没有启动完成 请稍后再试" + e.Message); } } else if (ReadLine == "GoodsStartTimer") { try { IGoods.IGoods goods = client.Result.GetGrain <IGoods.IGoods>(0); //grainReminder = goods.StartTimerTest().Result; //goods.StartTimerTestString("Test"); goods.StartTimer(); } catch (Exception e) { Console.WriteLine("服务暂时还没有启动完成 请稍后再试" + e.Message); } } else if (ReadLine == "GoodsStopTimer") { try { IGoods.IGoods goods = client.Result.GetGrain <IGoods.IGoods>(0); //goods.StopTimerTest(grainReminder).Wait(); goods.StopTimerTest("Test"); } catch (Exception e) { Console.WriteLine("服务暂时还没有启动完成 请稍后再试" + e.Message); } } else if (ReadLine == "ShoppingRecord") { try { IShoppingRecord.IShoppingRecord shoppingRecord = client.Result.GetGrain <IShoppingRecord.IShoppingRecord>(0); Console.WriteLine(shoppingRecord.GetShoppingRecordDescribe().Result); } catch (Exception e) { Console.WriteLine("服务暂时还没有启动完成 请稍后再试" + e.Message); } } } }
public Task UnregisterReminder(IGrainReminder reminder) { GetRemindersFor(CallingGrainReference).TryRemove(reminder.ReminderName, out _); return(Task.CompletedTask); }
private async ValueTask <bool> RecalculateReminderAsync() { DateTime mintime = DateTime.MaxValue; var lstTask = this.State; List <DispatchTask> lstbacktask = new List <DispatchTask>(); for (int i = lstTask.Count - 1; i >= 0; i--) { bool bneddtimer = false; if (lstTask[i].Tasktype == (int)TaskType.TT_PERIODIC) { if (lstTask[i].NewBegintime <= DateTime.Now.AddMinutes(_reminderTimerMinutes)) { bneddtimer = true; } else if (lstTask[i].NewBegintime < mintime) { mintime = lstTask[i].NewBegintime; } } else { if (lstTask[i].Starttime <= DateTime.Now.AddMinutes(_reminderTimerMinutes)) { bneddtimer = true; } else if (lstTask[i].Starttime < mintime) { mintime = lstTask[i].Starttime; } } if (bneddtimer) { lstbacktask.Add(lstTask[i]); lock (this.State) { this.State.Remove(lstTask[i]); } } } if (mintime != DateTime.MaxValue) { var nowtime = DateTime.Now; TimeSpan minspan; if (nowtime < mintime.AddMinutes(-1 * _reminderTimerMinutes)) { minspan = mintime.AddMinutes(-1 * (_reminderTimerMinutes - 1)) - nowtime; if (minspan != _reminderCurPeriod) { _grainReminder = await RegisterOrUpdateReminder(Cluster.TaskReminder, TimeSpan.FromSeconds(1), minspan); } } } if (lstbacktask != null && lstbacktask.Count > 0) { var membership = await GrainFactory.GetGrain <IManagementGrain>(0).GetHosts(true); foreach (var item in lstbacktask) { await GrainFactory.GetGrain <IScheduleTaskGrain>(item.Taskid % membership.Count).AddScheduleTaskAsync(item); } await WriteStateAsync(); return(true); } return(false); }
public ReminderTaskGrain(IConfiguration configuration) { _reminderCurPeriod = TimeSpan.MaxValue; _grainReminder = null; _reminderTimerMinutes = configuration.GetSection("Task:TaskSchedulePreviousTimer").Get <int>(); }
public async Task UnregisterReminder(IGrainReminder reminder) { await Mock.Object.UnregisterReminder(reminder); _reminders.Remove(reminder.ReminderName); }
Task IGrainReminderService.UnregisterReminder(IGrainReminder reminder) { return(UnregisterReminder(reminder)); }
public Task UnregisterReminder(IGrainReminder reminder) { return(GetReminderService("UnregisterReminder", reminder.ReminderName) .UnregisterReminder(reminder)); }
Task IActorEndpointReminderService.UnregisterReminder(IGrainReminder reminder) { return(UnregisterReminder(reminder)); }
public Task StopTimerTest(IGrainReminder grainReminder) { return(UnregisterReminder(grainReminder)); }
protected virtual Task UnregisterReminder(IGrainReminder reminder) { EnsureRuntime(); return(Runtime.ReminderRegistry.UnregisterReminder(reminder)); }
public Task UnregisterReminder(GrainId callingGrainId, IGrainReminder reminder) { this.EnsureReminderServiceRegistered(); return(GetGrainService(callingGrainId).UnregisterReminder(reminder)); }
public Task UnregisterReminder(IGrainReminder reminder) { throw new InvalidOperationException("UnregisterReminder can only be called from inside a grain"); }
private async Task RegisterReminderAsync() { var reminderTime = TimeSpan.FromMinutes(1); grainReminder = await RegisterOrUpdateReminder(ReminderName, reminderTime, reminderTime); }
protected virtual Task UnregisterReminder(IGrainReminder reminder) { return Runtime.ReminderRegistry.UnregisterReminder(reminder); }
public new Task UnregisterReminder(IGrainReminder reminder) { return(base.UnregisterReminder(reminder)); }
public Task UnregisterReminder(IGrainReminder reminder) { GrainReference ignore; return GetReminderService("UnregisterReminder", reminder.ReminderName, out ignore) .UnregisterReminder(reminder); }
public Task UnregisterReminder(GrainId callingGrainId, IGrainReminder reminder) => GetGrainService(callingGrainId).UnregisterReminder(reminder);
public Task UnregisterReminder(IGrainReminder reminder) => UnregisterReminder(reminder.ReminderName);