consumer.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. Copyright © 2023 lujiaming
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package consumer
  14. import (
  15. "go-admin/cmd/consumer/biz"
  16. "go-admin/cmd/consumer/metrics"
  17. "go-admin/cmd/consumer/traceurl"
  18. "github.com/spf13/cobra"
  19. )
  20. var configYml string
  21. // consumer/consumerCmd represents the consumer/consumer command
  22. var StartCmd = &cobra.Command{
  23. Use: "consumer",
  24. Short: "消费者命令",
  25. Long: `用于从消息中间件消费数据, 具体消费逻辑需要手动编写子命令`,
  26. Run: func(cmd *cobra.Command, args []string) {
  27. // fmt.Println("consumer/consumer called")
  28. cmd.Help()
  29. },
  30. }
  31. func init() {
  32. StartCmd.AddCommand(traceurl.TraceUrlCmd)
  33. StartCmd.AddCommand(biz.BizCmd)
  34. StartCmd.AddCommand(metrics.MetricsCmd)
  35. StartCmd.PersistentFlags().StringVarP(&configYml, "config", "c", "config/settings.yml", "启动命令时指定的配置文件, 默认为config/settings.yml")
  36. }