Esempio n. 1
0
 public tb_consumer_model RegisterConsumer(DbConn PubConn, int clientid, string clientname, List<int> partitionindexs)
 {
     long tempid =  CommonHelper.GenerateIntID();
     tb_consumer_dal dal = new tb_consumer_dal();
     dal.DeleteNotOnLineByClientID(PubConn, clientid, SystemParamConfig.Consumer_ConsumerHeartbeat_MAX_TIME_OUT);
     List<int> usedpartitionindexs = dal.GetRegisterPartitionIndexs(PubConn, clientid);
     var conflictpartitionindexs = (from o in usedpartitionindexs from n in partitionindexs where o == n select o).ToList();
     if (conflictpartitionindexs != null && conflictpartitionindexs.Count > 0)
     {
         throw new BusinessMQException(string.Format("当前分区序号已经被注册使用中,冲突分区序号为:{0},可能是上次消费者异常终止导致消费者依然在注册中,请尝试在{1}秒系统超时后重试。",
             string.Join(",",conflictpartitionindexs.ToArray()), SystemParamConfig.Consumer_ConsumerHeartbeat_MAX_TIME_OUT));
     }
     dal.Add2(PubConn, new tb_consumer_model() { clientname = clientname, consumerclientid = clientid, partitionindexs = string.Join(",", partitionindexs.ToArray()), tempid = tempid});
     return dal.Get(PubConn, tempid,clientid);
 }
Esempio n. 2
0
 public void ConsumerHeartbeat(DbConn PubConn, long tempid, int clientid)
 {
     tb_consumer_dal dal = new tb_consumer_dal();
     dal.ClientHeatbeat(PubConn, clientid, tempid);
 }
Esempio n. 3
0
 public void RemoveConsumer(DbConn PubConn, long tempid,int clientid)
 {
     tb_consumer_dal dal = new tb_consumer_dal();
     dal.DeleteClient(PubConn, clientid, tempid);
 }