apollo

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApolloHandlers []ApolloHandler
View Source
var ApolloResponseNil error = errors.New("*ApolloResponse is nil")

Functions

func GetAppInfoByApollo

func GetAppInfoByApollo(hostUrl string, appName string) ([]byte, error)

从配置中心获取appInfo

func GetAppInfoFromApollo

func GetAppInfoFromApollo(hostUrl string, appName string, v interface{}) error

GetAppInfoFromApollo 调用方需要将v结构体提前定义好。如果不知道,就定义成map[string]interface{}

func GetValueByKey

func GetValueByKey(key string) (string, error)

func InitApolloHandlers

func InitApolloHandlers(a ApolloHandler)

InitApolloHandlers 监听者赶紧到这里来,按时触发一系列动作

Types

type ApolloHandler

type ApolloHandler interface {
	Handler(omap, nMap map[string]string) error
}

ApolloHandler 当ApolloTimer 定时刷新的时候,主动触发此类操作

type ApolloResponse

type ApolloResponse struct {
	AppID          string            `json:"appId"`
	Cluster        string            `json:"cluster"`
	NamespaceName  string            `json:"namespaceName"`
	Configurations map[string]string `json:"configurations"`
	ReleaseKey     string            `json:"releaseKey"`
}

ApolloResponse 返回结构体

type ApolloTimer

type ApolloTimer interface {
	Start(cycle time.Duration)
	Close()
}

ApolloTimer apollo client 本地刷新器

func NewApolloListener

func NewApolloListener(hostUrl string, appName string) ApolloTimer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL