You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

client_config.go 2.1 kB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package config
  2. import (
  3. "time"
  4. )
  5. var clientConfig *ClientConfig
  6. type ClientConfig struct {
  7. ApplicationID string `yaml:"application_id" json:"application_id,omitempty"`
  8. TransactionServiceGroup string `yaml:"transaction_service_group" json:"transaction_service_group,omitempty"`
  9. EnableClientBatchSendRequest bool `yaml:"enable-rpc_client-batch-send-request" json:"enable-rpc_client-batch-send-request,omitempty"`
  10. SeataVersion string `yaml:"seata_version" json:"seata_version,omitempty"`
  11. GettyConfig GettyConfig `yaml:"getty" json:"getty,omitempty"`
  12. TMConfig TMConfig `yaml:"tm" json:"tm,omitempty"`
  13. ATConfig struct {
  14. DSN string `yaml:"dsn" json:"dsn,omitempty"`
  15. ReportRetryCount int `default:"5" yaml:"report_retry_count" json:"report_retry_count,omitempty"`
  16. ReportSuccessEnable bool `default:"false" yaml:"report_success_enable" json:"report_success_enable,omitempty"`
  17. LockRetryInterval time.Duration `default:"10ms" yaml:"lock_retry_interval" json:"lock_retry_interval,omitempty"`
  18. LockRetryTimes int `default:"30" yaml:"lock_retry_times" json:"lock_retry_times,omitempty"`
  19. } `yaml:"at" json:"at,omitempty"`
  20. RegistryConfig RegistryConfig `yaml:"registry_config" json:"registry_config,omitempty"` //注册中心配置信息
  21. ConfigCenterConfig ConfigCenterConfig `yaml:"config_center" json:"config_center,omitempty"` //配置中心配置信息
  22. }
  23. func GetClientConfig() *ClientConfig {
  24. // todo mock data
  25. //return clientConfig
  26. return &ClientConfig{
  27. GettyConfig: GetDefaultGettyConfig(),
  28. }
  29. }
  30. func GetTMConfig() TMConfig {
  31. return clientConfig.TMConfig
  32. }
  33. func GetDefaultClientConfig(applicationID string) ClientConfig {
  34. return ClientConfig{
  35. ApplicationID: applicationID,
  36. TransactionServiceGroup: "127.0.0.1:8091",
  37. EnableClientBatchSendRequest: false,
  38. SeataVersion: "1.1.0",
  39. GettyConfig: GetDefaultGettyConfig(),
  40. TMConfig: GetDefaultTmConfig(),
  41. }
  42. }

Go Implementation For Seata