Versions in this module Expand all Collapse all v0 v0.15.1 Aug 16, 2024 v0.15.0 Jul 8, 2024 v0.14.0 Apr 24, 2024 Changes in this version + const ComponentAttributeDelimiter + const ComponentAttributeKeyValueSeparator + const FxGroup + const TagBuildDateTime + const TagBuildNumber + const TagBuildVersion + const TagComponentAttributes + const TagContextPath + const TagInstanceUUID + const TagSecure + const TagServiceName + type ServiceRegistrar interface + Deregister func(ctx context.Context, registration ServiceRegistration) error + Register func(ctx context.Context, registration ServiceRegistration) error + type ServiceRegistration interface + AddTags func(tags ...string) + Address func() string + ID func() string + Meta func() map[string]any + Name func() string + Port func() int + RemoveTags func(tags ...string) + SetAddress func(addr string) + SetID func(id string) + SetMeta func(key string, value any) + SetName func(name string) + SetPort func(port int) + Tags func() []string + type ServiceRegistrationCustomizer interface + Customize func(ctx context.Context, reg ServiceRegistration) + func NewBuildInfoCustomizer() ServiceRegistrationCustomizer + func NewPropertiesBasedCustomizer(appCtx *bootstrap.ApplicationContext, propertyPaths map[string]string) ServiceRegistrationCustomizer + type ServiceRegistrationCustomizerFunc func(ctx context.Context, reg ServiceRegistration) + func (fn ServiceRegistrationCustomizerFunc) Customize(ctx context.Context, reg ServiceRegistration) v0.13.0 Feb 27, 2024 Changes in this version + const COMPONENT_ATTRIBUTE_DELIMITER + const DiscoveryPropertiesPrefix + const InstanceMetaKeyContextPath + const InstanceMetaKeySMCR + const InstanceMetaKeySecure + const InstanceMetaKeyVersion + const KEY_VALUE_SEPARATOR + const TAG_BUILD_DATE_TIME + const TAG_BUILD_NUMBER + const TAG_COMPONENT_ATTRIBUTES + const TAG_INSTANCE_ID + const TAG_MANAGED_SERVICE + const TAG_SERVICE_NAME + const TAG_VERSION + var COMPONENT_ATTRIBUTES_MAPPING = map[string]string + var ErrInstancerStopped = fmt.Errorf("instancer is already stopped") + func Deregister(ctx context.Context, connection *consul.Connection, ...) error + func NewRegistration(opts ...RegistrationOptions) *api.AgentServiceRegistration + func Register(ctx context.Context, connection *consul.Connection, ...) error + type Callback func(Instancer) + type Client interface + Context func() context.Context + Instancer func(serviceName string) (Instancer, error) + func NewConsulDiscoveryClient(ctx context.Context, conn *consul.Connection, opts ...ClientOptions) Client + type ClientConfig struct + DefaultSelector InstanceMatcher + Logger log.Logger + Verbose bool + type ClientOptions func(opt *ClientConfig) + type ConsulInstancer struct + func NewConsulInstancer(ctx context.Context, opts ...ConsulInstancerOptions) *ConsulInstancer + func (i *ConsulInstancer) Deregister(ch chan<- sd.Event) + func (i *ConsulInstancer) DeregisterCallback(id interface{}) + func (i *ConsulInstancer) Instances(matcher InstanceMatcher) (ret []*Instance, err error) + func (i *ConsulInstancer) Register(ch chan<- sd.Event) + func (i *ConsulInstancer) RegisterCallback(id interface{}, cb Callback) + func (i *ConsulInstancer) Service() (svc *Service) + func (i *ConsulInstancer) ServiceName() string + func (i *ConsulInstancer) Start(ctx context.Context) + func (i *ConsulInstancer) Stop() + type ConsulInstancerOption struct + ConsulConnection *consul.Connection + Logger log.Logger + Selector InstanceMatcher + ServiceName string + Verbose bool + type ConsulInstancerOptions func(opt *ConsulInstancerOption) + type Customizer interface + Customize func(ctx context.Context, reg *api.AgentServiceRegistration) + type CustomizerFunc func(ctx context.Context, reg *api.AgentServiceRegistration) + func (fn CustomizerFunc) Customize(ctx context.Context, reg *api.AgentServiceRegistration) + type Customizers struct + Customizers []Customizer + func NewCustomizers(ctx *bootstrap.ApplicationContext) *Customizers + func (r *Customizers) Add(c Customizer) + func (r *Customizers) Apply(ctx context.Context, registration *api.AgentServiceRegistration) + type DefaultCustomizer struct + func NewDefaultCustomizer(appContext *bootstrap.ApplicationContext) *DefaultCustomizer + func (d *DefaultCustomizer) Customize(ctx context.Context, registration *api.AgentServiceRegistration) + type DiscoveryProperties struct + AclToken string + DefaultSelector SelectorProperties + HealthCheckCriticalTimeout string + HealthCheckInterval string + HealthCheckPath string + Interface string + IpAddress string + Port int + Scheme string + Tags utils.CommaSeparatedSlice + func BindDiscoveryProperties(ctx *bootstrap.ApplicationContext) DiscoveryProperties + func NewDiscoveryProperties() *DiscoveryProperties + type HealthStatus int + const HealthAny + const HealthCritical + const HealthMaintenance + const HealthPassing + const HealthWarning + type Instance struct + Address string + Health HealthStatus + ID string + Meta map[string]string + Port int + RawEntry interface{} + Service string + Tags []string + type InstanceMatcher matcher.ChainableMatcher + func InstanceIsHealthy() InstanceMatcher + func InstanceWithHealth(status HealthStatus) InstanceMatcher + func InstanceWithMetaKV(key, value string) InstanceMatcher + func InstanceWithProperties(props *SelectorProperties) InstanceMatcher + func InstanceWithTag(tag string, caseInsensitive bool) InstanceMatcher + func InstanceWithTagKV(key, value string, caseInsensitive bool) InstanceMatcher + func InstanceWithVersion(verPattern string) InstanceMatcher + type Instancer interface + DeregisterCallback func(id interface{}) + Instances func(InstanceMatcher) ([]*Instance, error) + RegisterCallback func(id interface{}, cb Callback) + Service func() *Service + ServiceName func() string + Start func(ctx context.Context) + Stop func() + type RegistrationConfig struct + ApplicationName string + HealthCheckCriticalTimeout string + HealthCheckInterval string + HealthCheckPath string + HealthPort int + HealthScheme string + IPAddress string + NetworkInterface string + Port int + Tags []string + type RegistrationOptions func(cfg *RegistrationConfig) + func RegistrationWithProperties(appCtx *bootstrap.ApplicationContext, props DiscoveryProperties) RegistrationOptions + type SelectorProperties struct + Meta map[string]string + Tags utils.CommaSeparatedSlice + type Service struct + Err error + FirstErrAt time.Time + Insts []*Instance + Name string + Time time.Time + func (s *Service) InstanceCount(selector InstanceMatcher) (ret int) + func (s *Service) Instances(selector InstanceMatcher) (ret []*Instance) + type ServiceCache interface + Entries func() map[string]*Service + Get func(name string) *Service + Has func(name string) bool + Set func(name string, svc *Service) *Service + SetWithTTL func(name string, svc *Service, ttl time.Duration) *Service