File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616 Global struct {
1717 LogPath string `xml:"logpath,attr" yaml:"logpath"`
1818 IsRun bool `xml:"isrun,attr" yaml:"isrun"`
19+ Timeout int64 `xml:"timeout,attr" yaml:"timeout"` //全局超时配置,单位为毫秒
1920 } `xml:"global" yaml:"global"`
2021
2122 Tasks []struct {
2829 QueueSize int64 `xml:"queuesize,attr" yaml:"queuesize"` //queue类型下,queue初始长度
2930 HandlerName string `xml:"handlername,attr" yaml:"handlername"` //Task对应的HandlerName,需使用RegisterHandler进行统一注册
3031 HandlerData string `xml:"handlerdata,attr" yaml:"handlerdata"` //Task对应的自定义数据,可在配置源中设置
32+ Timeout int64 `xml:"timeout,attr" yaml:"timeout"` //全局超时配置,单位为毫秒
3133 } `xml:"tasks>task" yaml:"tasks"`
3234 }
3335
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ func main() {
3333
3434 //step 3: load config file
3535 service .LoadFileConfig ("c:/gotmp/dottask/task.conf" )
36+ fmt .Println (* service .Config )
3637
3738 fmt .Println (time .Now ().String (), " => Begin Task" )
3839 //step 4: start all task
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" UTF-8" ?>
2- <config >
3- <global isrun =" true" logpath =" d:/" />
4- <tasks >
5- <task taskid =" Loop_Config " type=" loop" isrun =" true" duetime =" 1000" interval =" 1000" handlername =" Loop_Config" ></task >
6- <task taskid =" Job_Config" type =" cron" isrun =" true" express =" 0 */5 * * * *" handlername =" Job_Config" ></task >
7- </tasks >
8- </config >
2+ <config >
3+ <global isrun =" true" logpath =" d:/" timeout = " 10000 " />
4+ <tasks >
5+ <task taskid =" Loop_Config " type=" loop" isrun =" true" duetime =" 1000" interval =" 1000" handlername =" Loop_Config" ></task >
6+ <task taskid =" Job_Config" type =" cron" isrun =" true" express =" 0 */5 * * * *" handlername =" Job_Config" ></task >
7+ </tasks >
8+ </config >
You can’t perform that action at this time.
0 commit comments