Esempio n. 1
0
        public virtual tb_consumer_partition_model CreateModel(DataRow dr)
        {
            var o = new tb_consumer_partition_model();

            //
            if(dr.Table.Columns.Contains("id"))
            {
                o.id = dr["id"].Toint();
            }
            //�����߿ͻ���ID
            if(dr.Table.Columns.Contains("consumerclientid"))
            {
                o.consumerclientid = dr["consumerclientid"].Toint();
            }
            //
            if(dr.Table.Columns.Contains("partitionindex"))
            {
                o.partitionindex = dr["partitionindex"].Toint();
            }
            //������ID
            if(dr.Table.Columns.Contains("partitionid"))
            {
                o.partitionid = dr["partitionid"].Toint();
            }
            //
            if(dr.Table.Columns.Contains("lastconsumertempid"))
            {
                o.lastconsumertempid = dr["lastconsumertempid"].Tolong();
            }
            //������ѵ�MQID
            if(dr.Table.Columns.Contains("lastmqid"))
            {
                o.lastmqid = dr["lastmqid"].Tolong();
            }
            //���������ִ��ʱ��(�Ե�ǰ��ʱ��Ϊ׼)
            if(dr.Table.Columns.Contains("lastupdatetime"))
            {
                o.lastupdatetime = dr["lastupdatetime"].ToDateTime();
            }
            //�����߷�������ʱ��(�Ե�ǰ��ʱ��Ϊ׼)
            if(dr.Table.Columns.Contains("createtime"))
            {
                o.createtime = dr["createtime"].ToDateTime();
            }
            return o;
        }
Esempio n. 2
0
        public virtual bool Add(DbConn PubConn, tb_consumer_partition_model model)
        {
            List<ProcedureParameter> Par = new List<ProcedureParameter>()
                {

                    //�����߿ͻ���ID
                    new ProcedureParameter("@consumerclientid",    model.consumerclientid),
                    //
                    new ProcedureParameter("@partitionindex",    model.partitionindex),
                    //������ID
                    new ProcedureParameter("@partitionid",    model.partitionid),
                    //
                    new ProcedureParameter("@lastconsumertempid",    model.lastconsumertempid),
                    //������ѵ�MQID
                    new ProcedureParameter("@lastmqid",    model.lastmqid),
                    //���������ִ��ʱ��(�Ե�ǰ��ʱ��Ϊ׼)
                    new ProcedureParameter("@lastupdatetime",    model.lastupdatetime),
                    //�����߷�������ʱ��(�Ե�ǰ��ʱ��Ϊ׼)
                    new ProcedureParameter("@createtime",    model.createtime)
                };
            int rev = PubConn.ExecuteSql(@"insert into tb_consumer_partition(consumerclientid,partitionindex,partitionid,lastconsumertempid,lastmqid,lastupdatetime,createtime)
                                           values(@consumerclientid,@partitionindex,@partitionid,@lastconsumertempid,@lastmqid,@lastupdatetime,@createtime)", Par);
            return rev == 1;
        }
Esempio n. 3
0
        public RegisterdConsumersModel(DataRow dr)
        {
            // s.id as tb_consumer_id,tempid as tb_consumer_tempid,s.consumerclientid as tb_consumer_consumerclientid,s.partitionindexs as tb_consumer_partitionindexs
            //,s.clientname as tb_consumer_clientname,s.lastheartbeat as tb_consumer_lastheartbeat,s.lastupdatetime as tb_consumer_lastupdatetime,s.createtime as tb_consumer_createtime,
            //c.id as tb_consumer_client_id, c.client as tb_consumer_client_client,c.createtime as tb_consumer_client_createtime, p.id as tb_consumer_partition_id,p.consumerclientid as tb_consumer_partition_consumerclientid
            //,p.partitionindex as tb_consumer_partition_partitionindex,p.partitionid as tb_consumer_partition_partitionid,p.lastconsumertempid as tb_consumer_partition_lastconsumertempid,p.lastmqid as tb_consumer_partition_lastmqid
            //,p.lastupdatetime as tb_consumer_partition_lastupdatetime,p.createtime as tb_consumer_partition_createtime
            consumermodel = new tb_consumer_model();
            //
            if (dr.Table.Columns.Contains("tb_consumer_id"))
            {
                consumermodel.id = dr["tb_consumer_id"].Toint();
            }
            //消费者临时id(消费者启动后唯一,Guid转long)
            if (dr.Table.Columns.Contains("tb_consumer_tempid"))
            {
                consumermodel.tempid = dr["tb_consumer_tempid"].Tolong();
            }
            //消费者clinet的id
            if (dr.Table.Columns.Contains("tb_consumer_consumerclientid"))
            {
                consumermodel.consumerclientid = dr["tb_consumer_consumerclientid"].Toint();
            }
            //支持的分区顺序号(支持多个顺序号)
            if (dr.Table.Columns.Contains("tb_consumer_partitionindexs"))
            {
                consumermodel.partitionindexs = dr["tb_consumer_partitionindexs"].Tostring();
            }
            //客户端名称
            if (dr.Table.Columns.Contains("tb_consumer_clientname"))
            {
                consumermodel.clientname = dr["tb_consumer_clientname"].Tostring();
            }
            //最后心跳时间(以当前库时间为准)
            if (dr.Table.Columns.Contains("tb_consumer_lastheartbeat"))
            {
                consumermodel.lastheartbeat = dr["tb_consumer_lastheartbeat"].ToDateTime();
            }
            //上一次更新时间(以当前库时间为准)
            if (dr.Table.Columns.Contains("tb_consumer_lastupdatetime"))
            {
                consumermodel.lastupdatetime = dr["tb_consumer_lastupdatetime"].ToDateTime();
            }
            //客户端创建时间(以当前库时间为准)
            if (dr.Table.Columns.Contains("tb_consumer_createtime"))
            {
                consumermodel.createtime = dr["tb_consumer_createtime"].ToDateTime();
            }

            consumerclientmodel = new tb_consumer_client_model();
            //
            if (dr.Table.Columns.Contains("tb_consumer_client_id"))
            {
                consumerclientmodel.id = dr["tb_consumer_client_id"].Toint();
            }
            //客户端(消费者client,相同业务消费者注册必须一致)
            if (dr.Table.Columns.Contains("tb_consumer_client_client"))
            {
                consumerclientmodel.client = dr["tb_consumer_client_client"].Tostring();
            }
            //当前消费者创建时间(以当前库时间为准)
            if (dr.Table.Columns.Contains("createtime"))
            {
                consumerclientmodel.createtime = dr["tb_consumer_client_createtime"].ToDateTime();
            }

             consumerpartitionmodel = new tb_consumer_partition_model();

            //
             if (dr.Table.Columns.Contains("tb_consumer_partition_id"))
            {
                consumerpartitionmodel.id = dr["tb_consumer_partition_id"].Toint();
            }
            //消费者客户端ID
             if (dr.Table.Columns.Contains("tb_consumer_partition_consumerclientid"))
            {
                consumerpartitionmodel.consumerclientid = dr["tb_consumer_partition_consumerclientid"].Toint();
            }
            //
             if (dr.Table.Columns.Contains("tb_consumer_partition_partitionindex"))
            {
                consumerpartitionmodel.partitionindex = dr["tb_consumer_partition_partitionindex"].Toint();
            }
            //分区表ID
             if (dr.Table.Columns.Contains("tb_consumer_partition_partitionid"))
            {
                consumerpartitionmodel.partitionid = dr["tb_consumer_partition_partitionid"].Toint();
            }
            //
             if (dr.Table.Columns.Contains("tb_consumer_partition_lastconsumertempid"))
            {
                consumerpartitionmodel.lastconsumertempid = dr["tb_consumer_partition_lastconsumertempid"].Tolong();
            }
            //最后消费的MQID
             if (dr.Table.Columns.Contains("tb_consumer_partition_lastmqid"))
            {
                consumerpartitionmodel.lastmqid = dr["tb_consumer_partition_lastmqid"].Tolong();
            }
            //消费者最后执行时间(以当前库时间为准)
             if (dr.Table.Columns.Contains("tb_consumer_partition_lastupdatetime"))
            {
                consumerpartitionmodel.lastupdatetime = dr["tb_consumer_partition_lastupdatetime"].ToDateTime();
            }
            //消费者分区创建时间(以当前库时间为准)
             if (dr.Table.Columns.Contains("tb_consumer_partition_createtime"))
            {
                consumerpartitionmodel.createtime = dr["tb_consumer_partition_createtime"].ToDateTime();
            }
        }
Esempio n. 4
0
        public virtual bool Edit(DbConn PubConn, tb_consumer_partition_model model)
        {
            List<ProcedureParameter> Par = new List<ProcedureParameter>()
            {

                    //�����߿ͻ���ID
                    new ProcedureParameter("@consumerclientid",    model.consumerclientid),
                    //
                    new ProcedureParameter("@partitionindex",    model.partitionindex),
                    //������ID
                    new ProcedureParameter("@partitionid",    model.partitionid),
                    //
                    new ProcedureParameter("@lastconsumertempid",    model.lastconsumertempid),
                    //������ѵ�MQID
                    new ProcedureParameter("@lastmqid",    model.lastmqid),
                    //���������ִ��ʱ��(�Ե�ǰ��ʱ��Ϊ׼)
                    new ProcedureParameter("@lastupdatetime",    model.lastupdatetime),
                    //�����߷�������ʱ��(�Ե�ǰ��ʱ��Ϊ׼)
                    new ProcedureParameter("@createtime",    model.createtime)
            };
            Par.Add(new ProcedureParameter("@id",  model.id));

            int rev = PubConn.ExecuteSql("update tb_consumer_partition set consumerclientid=@consumerclientid,partitionindex=@partitionindex,partitionid=@partitionid,lastconsumertempid=@lastconsumertempid,lastmqid=@lastmqid,lastupdatetime=@lastupdatetime,createtime=@createtime where id=@id", Par);
            return rev == 1;
        }
Esempio n. 5
0
        public RegisterdConsumersModel(DataRow dr)
        {
// s.id as tb_consumer_id,tempid as tb_consumer_tempid,s.consumerclientid as tb_consumer_consumerclientid,s.partitionindexs as tb_consumer_partitionindexs
//,s.clientname as tb_consumer_clientname,s.lastheartbeat as tb_consumer_lastheartbeat,s.lastupdatetime as tb_consumer_lastupdatetime,s.createtime as tb_consumer_createtime,
//c.id as tb_consumer_client_id, c.client as tb_consumer_client_client,c.createtime as tb_consumer_client_createtime, p.id as tb_consumer_partition_id,p.consumerclientid as tb_consumer_partition_consumerclientid
//,p.partitionindex as tb_consumer_partition_partitionindex,p.partitionid as tb_consumer_partition_partitionid,p.lastconsumertempid as tb_consumer_partition_lastconsumertempid,p.lastmqid as tb_consumer_partition_lastmqid
//,p.lastupdatetime as tb_consumer_partition_lastupdatetime,p.createtime as tb_consumer_partition_createtime
            consumermodel = new tb_consumer_model();
            //
            if (dr.Table.Columns.Contains("tb_consumer_id"))
            {
                consumermodel.id = dr["tb_consumer_id"].Toint();
            }
            //消费者临时id(消费者启动后唯一,Guid转long)
            if (dr.Table.Columns.Contains("tb_consumer_tempid"))
            {
                consumermodel.tempid = dr["tb_consumer_tempid"].Tolong();
            }
            //消费者clinet的id
            if (dr.Table.Columns.Contains("tb_consumer_consumerclientid"))
            {
                consumermodel.consumerclientid = dr["tb_consumer_consumerclientid"].Toint();
            }
            //支持的分区顺序号(支持多个顺序号)
            if (dr.Table.Columns.Contains("tb_consumer_partitionindexs"))
            {
                consumermodel.partitionindexs = dr["tb_consumer_partitionindexs"].Tostring();
            }
            //客户端名称
            if (dr.Table.Columns.Contains("tb_consumer_clientname"))
            {
                consumermodel.clientname = dr["tb_consumer_clientname"].Tostring();
            }
            //最后心跳时间(以当前库时间为准)
            if (dr.Table.Columns.Contains("tb_consumer_lastheartbeat"))
            {
                consumermodel.lastheartbeat = dr["tb_consumer_lastheartbeat"].ToDateTime();
            }
            //上一次更新时间(以当前库时间为准)
            if (dr.Table.Columns.Contains("tb_consumer_lastupdatetime"))
            {
                consumermodel.lastupdatetime = dr["tb_consumer_lastupdatetime"].ToDateTime();
            }
            //客户端创建时间(以当前库时间为准)
            if (dr.Table.Columns.Contains("tb_consumer_createtime"))
            {
                consumermodel.createtime = dr["tb_consumer_createtime"].ToDateTime();
            }

            consumerclientmodel = new tb_consumer_client_model();
            //
            if (dr.Table.Columns.Contains("tb_consumer_client_id"))
            {
                consumerclientmodel.id = dr["tb_consumer_client_id"].Toint();
            }
            //客户端(消费者client,相同业务消费者注册必须一致)
            if (dr.Table.Columns.Contains("tb_consumer_client_client"))
            {
                consumerclientmodel.client = dr["tb_consumer_client_client"].Tostring();
            }
            //当前消费者创建时间(以当前库时间为准)
            if (dr.Table.Columns.Contains("createtime"))
            {
                consumerclientmodel.createtime = dr["tb_consumer_client_createtime"].ToDateTime();
            }

            consumerpartitionmodel = new tb_consumer_partition_model();

            //
            if (dr.Table.Columns.Contains("tb_consumer_partition_id"))
            {
                consumerpartitionmodel.id = dr["tb_consumer_partition_id"].Toint();
            }
            //消费者客户端ID
            if (dr.Table.Columns.Contains("tb_consumer_partition_consumerclientid"))
            {
                consumerpartitionmodel.consumerclientid = dr["tb_consumer_partition_consumerclientid"].Toint();
            }
            //
            if (dr.Table.Columns.Contains("tb_consumer_partition_partitionindex"))
            {
                consumerpartitionmodel.partitionindex = dr["tb_consumer_partition_partitionindex"].Toint();
            }
            //分区表ID
            if (dr.Table.Columns.Contains("tb_consumer_partition_partitionid"))
            {
                consumerpartitionmodel.partitionid = dr["tb_consumer_partition_partitionid"].Toint();
            }
            //
            if (dr.Table.Columns.Contains("tb_consumer_partition_lastconsumertempid"))
            {
                consumerpartitionmodel.lastconsumertempid = dr["tb_consumer_partition_lastconsumertempid"].Tolong();
            }
            //最后消费的MQID
            if (dr.Table.Columns.Contains("tb_consumer_partition_lastmqid"))
            {
                consumerpartitionmodel.lastmqid = dr["tb_consumer_partition_lastmqid"].Tolong();
            }
            //消费者最后执行时间(以当前库时间为准)
            if (dr.Table.Columns.Contains("tb_consumer_partition_lastupdatetime"))
            {
                consumerpartitionmodel.lastupdatetime = dr["tb_consumer_partition_lastupdatetime"].ToDateTime();
            }
            //消费者分区创建时间(以当前库时间为准)
            if (dr.Table.Columns.Contains("tb_consumer_partition_createtime"))
            {
                consumerpartitionmodel.createtime = dr["tb_consumer_partition_createtime"].ToDateTime();
            }
        }