using Newtonsoft.Json; using Rafy; using Rafy.Domain; using System; using System.Collections.Generic; using System.Linq; namespace DBI.SaaS.MessageService.Controller { public class TimersInvoke { private LogController log; public TimersInvoke() { this.log = new LogController(); } System.Timers.Timer timer = new System.Timers.Timer(); public void StartTimer() { timer.Elapsed += new System.Timers.ElapsedEventHandler(InvokeFailMsg); timer.Enabled = true;//是否触发Elapsed事件 timer.AutoReset = true; //每到指定时间Elapsed事件是触发一次(false),还是一直触发(true) timer.Interval = 5000;// 设置时间间隔为5秒 } /// <summary> /// 重发失败表通知 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void InvokeFailMsg(object sender, System.Timers.ElapsedEventArgs e) { //这里处理你定时重发的事件 } } }