feat: support retry produce fix: optimize code logic fix: use producer max reput retry times enhance: add more detail logs and modify format enhance: modify style log: fill unfinished log content
feat: support retry produce
fix: optimize code logic
fix: use producer max reput retry times
enhance: add more detail logs and modify format
enhance: modify style
log: fill unfinished log content
Install your specific service package with the following command.
You can install the entire SDK to GoPath by go get:
$ go get github.com/XiaoMi/talos-sdk-golang
Or add the module to your go.mod:
go mod edit -require=github.com/XiaoMi/talos-sdk-golang@v0.2.12
We have an Tutorial Demo in package example/, here we choose talos_consumer to explain the use process
To use SDK, import like this:
import ( "github.com/XiaoMi/talos-sdk-golang/consumer" "github.com/XiaoMi/talos-sdk-golang/utils" log "github.com/sirupsen/logrus" )
Reference talosConsumer.conf, you can configure like this:
galaxy.talos.service.endpoint=ENDPOINT galaxy.talos.topic.name=MY-TOPIC galaxy.talos.access.key=MY-APP-KEY galaxy.talos.access.secret=MY-SECRET-KEY
Notice
// user can customize log format or use default format // log.SetOutput(os.Stdout) // log.SetLevel(log.InfoLevel) utils.InitLog() // init properties from talosConsumer.conf var propertyFilename string flag.StringVar(&propertyFilename, "conf", "talosProducer.conf", "conf: talosConsumer.conf'") flag.Parse() // constructor talosConsumer, err := consumer.NewTalosConsumerByFilename(propertyFilename, NewMyMessageProcessorFactory(), client.NewSimpleTopicAbnormalCallback()) if err != nil { log.Errorf("init talosConsumer failed: %s", err.Error()) return } // shutdown, graceful exit go func() { time.Sleep(5 * time.Second) talosConsumer.ShutDown() }() // block main function and wait shutdown talosConsumer.WaitGroup.Wait()
Then user can run this demo to fetch data
$ go run $path/TalosConsumerDemo.go [-config] [$path/talosConsumer.conf]
or
$ cd example/talos_consumer $ go build TalosConsumerDemo.go $ ./TalosConsumerDemo [-config] [$path/talosConsumer.conf]
Talos Wiki
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
Installing
Install your specific service package with the following command.
You can install the entire SDK to GoPath by go get:
$ go get github.com/XiaoMi/talos-sdk-golangOr add the module to your go.mod:
go mod edit -require=github.com/XiaoMi/talos-sdk-golang@v0.2.12Tutorial
We have an Tutorial Demo in package example/, here we choose talos_consumer to explain the use process
import
To use SDK, import like this:
Configuration profile
Reference talosConsumer.conf, you can configure like this:
Notice
Coding
Go run & Go build
Then user can run this demo to fetch data
or
Talos Book
Talos Wiki