Exemplo n.º 1
0
        private void SlidTimeWindow(DateTime dateTime)
        {
            long curLong = DateTimeUtil.DateTimeToTimeStamp(dateTime);

            int offsetTime = (int)(curLong % WindowInterval);

            _cache.LeftTime  = DateTimeUtil.TimeStampToDateTime(curLong - offsetTime);
            _cache.RightTime = _cache.LeftTime.AddSeconds(WindowInterval);

            Console.WriteLine($"{Name}-SlidTimeWindow:{CalculateOperator.GetType().ToString ()}_{WindowInterval.ToString()}:{_cache.LeftTime.ToString()}-{_cache.RightTime.ToString()}");
        }
Exemplo n.º 2
0
        private void PublishCalculate(string sessinId, DateTime nowTime, DateTime leftTime, DateTime rightTime, IMetaData[] ds, string desc)
        {
            if (ds.Length > 0)
            {
                ICalculateContext calculateContext = new CalculateContext(Name, desc + "_" + CalculateOperator.GetType().ToString(), leftTime, rightTime, CalculateType.Aggregate, new CalculateInpute(sessinId, "", rightTime, ds), null, CalculateOperator);

                GlobalContext.ActionBlock.Post(calculateContext);

                ds = null;
            }
            else
            {
                Logger.Log.Info(true, Name + " 没有要发布的窗口任务");
            }
        }