diff --git a/adaptors/安心云es主题特征to河北公路设施监测.go b/adaptors/安心云es主题特征to河北公路设施监测.go index 07db9cc..aacd6c0 100644 --- a/adaptors/安心云es主题特征to河北公路设施监测.go +++ b/adaptors/安心云es主题特征to河北公路设施监测.go @@ -2,6 +2,7 @@ package adaptors import ( "encoding/json" + "github.com/labstack/gommon/log" "goInOut/consumers/HBJCAS/protoFiles_hb" "goInOut/models" "google.golang.org/protobuf/proto" @@ -32,34 +33,46 @@ func (the Adaptor_AXYES_HBGL) Transform(rawMsg string) []NeedPush { return needPush } -func (the Adaptor_AXYES_HBGL) EsAggTopToHBJCAS(esAgg models.EsThemeAggDateHistogram) (result []byte) { - - Atime := time.Now() - QjComplexData := &protoFiles_hb.ComplexData{} - dataDefinitionStatisticData := &protoFiles_hb.DataDefinition_StatisticData{ - StatisticData: &protoFiles_hb.StatisticData{ - MonitorType: protoFiles_hb.MonitoryType_INC, - MonitorCode: 13000100001, - EventTime: Atime.Add(-8 * time.Hour).UnixMilli(), - Interval: 60 * 1000, - DataBody: &protoFiles_hb.StatisticData_Inc{Inc: &protoFiles_hb.INCStatistic{ - MaxAbsoluteValueX: 0, - AvgValueX: 0, - RootMeanSquareX: 0, - MaxAbsoluteValueY: 0, - AvgValueY: 0, - RootMeanSquareY: 0, - }}, - }, +func (the Adaptor_AXYES_HBGL) EsAggTopToHBJCAS(esAggs models.EsThemeAggDateHistogram) (result []byte) { + buckets := esAggs.Aggregations.GroupSensor.Buckets + if len(buckets) == 0 { + log.Info("es agg数据数量==0") + return } + //数据汇总 + complexData := &protoFiles_hb.ComplexData{} + for _, sensorBucket := range buckets { + //sensorId := sensorBucket.Key + for _, dateBucket := range sensorBucket.GroupDate.Buckets { + Atime := dateBucket.KeyAsString + dataDefinitionStatisticData := &protoFiles_hb.DataDefinition_StatisticData{ + StatisticData: &protoFiles_hb.StatisticData{ + MonitorType: protoFiles_hb.MonitoryType_INC, + MonitorCode: 13000100001, //测点唯一编码 + EventTime: Atime.Add(-8 * time.Hour).UnixMilli(), + Interval: 60 * 1000, + DataBody: &protoFiles_hb.StatisticData_Inc{Inc: &protoFiles_hb.INCStatistic{ + MaxAbsoluteValueX: 0, + AvgValueX: 0, + RootMeanSquareX: 0, + MaxAbsoluteValueY: 0, + AvgValueY: 0, + RootMeanSquareY: 0, + }}, + }, + } + + dataDefinition := &protoFiles_hb.DataDefinition{ + DataType: protoFiles_hb.DataType_STATISTICS, + UniqueCode: "130109", //乃积沟大桥 + DataBody: dataDefinitionStatisticData, + } + + complexData.SensorData = append(complexData.SensorData, dataDefinition) + } - dataDefinition := &protoFiles_hb.DataDefinition{ - DataType: protoFiles_hb.DataType_STATISTICS, - UniqueCode: "130109", //乃积沟大桥 - DataBody: dataDefinitionStatisticData, } - QjComplexData.SensorData = append(QjComplexData.SensorData, dataDefinition) - result, _ = proto.Marshal(QjComplexData) + result, _ = proto.Marshal(complexData) return result } diff --git a/config/configStruct.go b/config/configStruct.go index b12a9f4..0756601 100644 --- a/config/configStruct.go +++ b/config/configStruct.go @@ -1,7 +1,7 @@ package config type Consumer struct { - Consumer string `json:"consumer"` + Consumer string `json:"consumer" yaml:"consumer"` } type DbConfig struct { @@ -10,12 +10,12 @@ type DbConfig struct { } type MqttConfig struct { - Host string `json:"host"` - Port int `json:"port"` - UserName string `json:"userName"` - Password string `json:"password"` - ClientId string `json:"clientId"` - Topics []string `json:"topics"` + Host string `json:"host" yaml:"host"` + Port int `json:"port" yaml:"port"` + UserName string `json:"userName" yaml:"userName"` + Password string `json:"password" yaml:"password"` + ClientId string `json:"clientId" yaml:"clientId"` + Topics []string `json:"topics" yaml:"topics"` } type KafkaConfig struct { Brokers []string `json:"brokers"` diff --git a/config/init.go b/config/init.go index 9281734..c6686c5 100644 --- a/config/init.go +++ b/config/init.go @@ -3,6 +3,7 @@ package config import ( "encoding/json" "fmt" + "gopkg.in/yaml.v3" "log" "os" ) @@ -34,6 +35,35 @@ func LoadConfigJson() map[string]string { } return allConfig } + +func LoadConfig() map[string]string { + allConfig := make(map[string]string) + + files, err := os.ReadDir("configFiles") + if err != nil { + log.Fatal(err) + } + + for _, file := range files { + log.Printf("加载配置文件:%s", file.Name()) + if file.IsDir() { + log.Printf("非文件[%s]跳过", file.Name()) + continue + } + // 读取配置 + configBytes, _ := os.ReadFile(fmt.Sprintf("configFiles/%s", file.Name())) + consumer := new(Consumer) + // 将 JSON 格式的数据解析到结构体中 + err = yaml.Unmarshal(configBytes, &consumer) + if err != nil { + log.Printf("读取配置文件[%s]异常 err=%v", consumer.Consumer, err.Error()) + continue + } + allConfig[consumer.Consumer] = string(configBytes) + } + return allConfig +} + func LoadConfigJsonByPath(path string) map[string]string { //加载目录下所有文件 allConfig := make(map[string]string) diff --git a/configFiles/config_河北省公路基础设施监测_承德_轻量化特征数据.json b/configFiles/config_河北省公路基础设施监测_承德_轻量化特征数据.json deleted file mode 100644 index cb64663..0000000 --- a/configFiles/config_河北省公路基础设施监测_承德_轻量化特征数据.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "consumer": "consumerHBJCAS", - "ioConfig": { - "in": { - "http": { - "url": "https://esproxy.anxinyun.cn/anxincloud_themes/_search" - }, - "cronStr": "55 0/1 * * *" - }, - "out": { - "mqtt": { - "host": "10.8.30.160", - "port": 30883, - "userName": "bs1307", - "password": "7vEh(xomn9DX4X(L", - "clientId": "chengDe", - "Topics": [ - "t/province/1307" - ] - } - } - }, - "info": { - "structureId": "5016", - "rc4key": "sK3kJttzZyf7aZI94zSYgytBYCrfZRt6yil2" - } -} \ No newline at end of file diff --git a/configFiles/config_河北省公路基础设施监测_承德_轻量化特征数据.yaml b/configFiles/config_河北省公路基础设施监测_承德_轻量化特征数据.yaml new file mode 100644 index 0000000..bf7ee9e --- /dev/null +++ b/configFiles/config_河北省公路基础设施监测_承德_轻量化特征数据.yaml @@ -0,0 +1,23 @@ +consumer: consumerHBJCAS +ioConfig: + in: + http: + url: https://esproxy.anxinyun.cn/anxincloud_themes/_search + cronStr: 55 0/1 * * * + out: + mqtt: + host: 10.8.30.160 + port: 30883 + userName: bs1307 + password: 7vEh(xomn9DX4X(L + clientId: chengDe + topics: + - t/province/1307 +info: + structureId: '5016' + rc4key: sK3kJttzZyf7aZI94zSYgytBYCrfZRt6yil2 +pointInfo: + '5016': + '68684': 13000100001 + '68685': 13000100002 + '68686': 13000100003 diff --git a/consumers/HBJCAS/config.go b/consumers/HBJCAS/config.go index 7e4ae9d..c75771c 100644 --- a/consumers/HBJCAS/config.go +++ b/consumers/HBJCAS/config.go @@ -3,17 +3,16 @@ package HBJCAS import "goInOut/config" type ConfigFile struct { - config.Consumer - IoConfig ioConfig `json:"ioConfig"` - OtherInfo map[string]string `json:"info"` + IoConfig ioConfig `yaml:"ioConfig"` + OtherInfo map[string]string `yaml:"info"` } type ioConfig struct { - In In `json:"in"` - Out OUT `json:"out"` + In In `yaml:"in"` + Out OUT `yaml:"out"` } type In struct { - Http config.HttpConfig `json:"http"` - CronStr string `json:"cronStr"` + Http config.HttpConfig `yaml:"http"` + CronStr string `yaml:"cronStr"` } type OUT struct { diff --git a/consumers/consumerHBJCAS.go b/consumers/consumerHBJCAS.go index eebab5f..e916b93 100644 --- a/consumers/consumerHBJCAS.go +++ b/consumers/consumerHBJCAS.go @@ -3,13 +3,13 @@ package consumers import ( "crypto/rc4" "encoding/hex" - "encoding/json" "fmt" "goInOut/adaptors" "goInOut/consumers/HBJCAS" "goInOut/dbOperate" "goInOut/monitors" "goInOut/utils" + "gopkg.in/yaml.v3" "log" "time" ) @@ -26,7 +26,7 @@ type consumerHBJCAS struct { func (the *consumerHBJCAS) LoadConfigJson(cfgStr string) { // 将 JSON 格式的数据解析到结构体中 - err := json.Unmarshal([]byte(cfgStr), &the.Info) + err := yaml.Unmarshal([]byte(cfgStr), &the.Info) if err != nil { log.Printf("读取配置文件[%s]异常 err=%v", cfgStr, err.Error()) panic(err) diff --git a/go.mod b/go.mod index 26bab5d..7be0410 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,7 @@ require ( github.com/go-sql-driver/mysql v1.8.1 github.com/influxdata/influxdb-client-go/v2 v2.13.0 github.com/jmoiron/sqlx v1.4.0 + github.com/labstack/gommon v0.4.0 github.com/lib/pq v1.10.9 github.com/mattn/go-sqlite3 v1.14.24 github.com/redis/go-redis/v9 v9.7.0 @@ -16,6 +17,7 @@ require ( golang.org/x/text v0.17.0 google.golang.org/protobuf v1.31.0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 + gopkg.in/yaml.v3 v3.0.1 ) require ( @@ -40,10 +42,17 @@ require ( github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect github.com/jcmturner/rpc/v2 v2.0.3 // indirect github.com/klauspost/compress v1.17.9 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect github.com/oapi-codegen/runtime v1.0.0 // indirect github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect + github.com/rogpeppe/go-internal v1.13.1 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/fasttemplate v1.2.2 // indirect golang.org/x/crypto v0.26.0 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.23.0 // indirect ) diff --git a/go.sum b/go.sum index 64a1995..f6f7541 100644 --- a/go.sum +++ b/go.sum @@ -12,6 +12,7 @@ github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -70,8 +71,21 @@ github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= +github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM= github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= @@ -87,17 +101,25 @@ github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= +github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -120,9 +142,16 @@ golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= +golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -143,9 +172,12 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/main.go b/main.go index 1446613..4e7d747 100644 --- a/main.go +++ b/main.go @@ -29,7 +29,7 @@ func main() { log.Println("进程启动") //初始化读取配置 - myConfigs := config.LoadConfigJson() //数据存储 + myConfigs := config.LoadConfig() //数据存储 for consumerName, consumerConfig := range myConfigs { consumer := consumers.GetConsumer(consumerName) if consumer == nil {