public JsonResult GetDayList(string node, string tablepartition) { try { string mqpath = ""; using (DbConn conn = DbConfig.CreateConn(DataConfig.MqManage)) { conn.Open(); tb_mqpath_dal mqpathdal = new tb_mqpath_dal(); var model = mqpathdal.GetByPartitionID(conn, PartitionRuleHelper.GetPartitionID(new PartitionIDInfo() { DataNodePartition = Convert.ToInt32(node), TablePartition = Convert.ToInt32(tablepartition) })); if (model != null) { mqpath = model.mqpath; } } using (DbConn conn = DbConfig.CreateConn(DataConfig.DataNodeParConn(node))) { conn.Open(); var array = new tb_messagequeue_dal().GetDayPartitions(conn, Convert.ToInt32(tablepartition)).Select(c => c.ToString("yyMMdd")).ToList(); if (array != null && array.Count > 0) { return(Json(new { array, mqpath }, JsonRequestBehavior.AllowGet)); } return(Json("", JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json("", JsonRequestBehavior.AllowGet)); } }
public ProducterInfo GetProducterInfo(DbConn PubConn, string mqpath, string productername) { ProducterInfo r = new ProducterInfo(); tb_mqpath_dal mqpathdal = new tb_mqpath_dal(); r.MqPathModel = mqpathdal.Get(PubConn, mqpath); if (r.MqPathModel == null) { throw new BusinessMQException(string.Format("当前mqpath:{0}未在MQ中注册队列,请联系管理员注册成功后使用。", mqpath)); } tb_mqpath_partition_dal mqpathpartitiondal = new tb_mqpath_partition_dal(); r.MqPathParitionModel = mqpathpartitiondal.GetList(PubConn, r.MqPathModel.id); if (r.MqPathParitionModel == null || r.MqPathParitionModel.Count == 0) { throw new BusinessMQException(string.Format("当前mqpath:{0}未在MQ中分配相应的分区,请联系管理员分配分区后使用。", mqpath)); } //注册生产者 r.ProducterModel = this.RegisterProducter(PubConn, r.MqPathModel.id, productername); //获取分区相关节点 List <int> datanodepartition = new List <int>(); foreach (var p in r.MqPathParitionModel) { var partitionidinfo = PartitionRuleHelper.GetPartitionIDInfo(p.partitionid); if (!datanodepartition.Contains(partitionidinfo.DataNodePartition)) { datanodepartition.Add(partitionidinfo.DataNodePartition); } } r.DataNodeModelDic = this.GetDataNodeModelsDic(PubConn, datanodepartition); return(r); }
public tb_mqpath_model GetMqPathModel(DbConn PubConn, string mqpath) { tb_mqpath_dal mqpathdal = new tb_mqpath_dal(); var mqpathmodel = mqpathdal.Get(PubConn, mqpath); if (mqpathmodel == null) { throw new BusinessMQException("当前队列不存在:" + mqpath); } return(mqpathmodel); }
public virtual void SendCommandToRedistReStart(int mqpathid, EnumCommandReceiver receivier) { using (DbConn conn = DbConfig.CreateConn(DataConfig.MqManage)) { conn.Open(); var model = new tb_mqpath_dal().Get(conn, mqpathid); RedisHelper.SendMessage(DataConfig.RedisServer, XXF.BaseService.MessageQuque.BusinessMQ.SystemRuntime.SystemParamConfig.Redis_Channel, new XXF.BaseService.MessageQuque.BusinessMQ.SystemRuntime.BusinessMQNetCommand() { MqPath = model.mqpath, CommandType = EnumCommandType.Register, CommandReceiver = receivier }); } }
public virtual void ReStartQuque(int mqpathid) { tb_mqpath_model model; using (DbConn conn = DbConfig.CreateConn(DataConfig.MqManage)) { try { conn.Open(); conn.BeginTransaction(); model = new tb_mqpath_dal().Get(conn, mqpathid); new tb_mqpath_dal().UpdateLastUpdateTime(conn, mqpathid); conn.Commit(); } catch (Exception exp) { conn.Rollback(); throw exp; } SendCommandToRedistReStart(mqpathid, EnumCommandReceiver.All); } }
public DateTime?GetLastUpdateTimeOfMqPath(DbConn PubConn, string mqpath) { tb_mqpath_dal mqpathdal = new tb_mqpath_dal(); return(mqpathdal.GetLastUpdateTimeOfMqPath(PubConn, mqpath)); }