Пример #1
0
 public ActionResult Update(int id)
 {
     using (DbConn conn = DbConfig.CreateConn(DataConfig.MqManage))
     {
         conn.Open();
         tb_mqpath_model model = pathDal.Get(conn, id);
         return(View(model));
     }
 }
        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);
        }
Пример #3
0
        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);
        }