Documentation
¶
Index ¶
- type HostDiscoveryNotification
- type NotifierClient
- func (n *NotifierClient) Close()
- func (n *NotifierClient) ConfiguredForNotifierClientDial() bool
- func (n *NotifierClient) ConfiguredSNSDiscoveryTopicArn() string
- func (n *NotifierClient) Dial() error
- func (n *NotifierClient) NotifierClientAlertServicesStarted() bool
- func (n *NotifierClient) Subscribe(topicArn string) error
- func (n *NotifierClient) Unsubscribe() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HostDiscoveryNotification ¶
type HostDiscoveryNotification struct {
MsgType string `json:"msg_type"`
Action string `json:"action"`
Host string `json:"host"`
}
`{"msg_type":"host-discovery", "action":"online | offline", "host":"123.123.123.123:9999"}`
func (*HostDiscoveryNotification) Marshal ¶
func (d *HostDiscoveryNotification) Marshal() (string, error)
func (*HostDiscoveryNotification) Unmarshal ¶
func (d *HostDiscoveryNotification) Unmarshal(jsonData string) error
type NotifierClient ¶
type NotifierClient struct {
AppName string
ConfigFileName string
CustomConfigPath string
BeforeClientDialHandler func(*client.Client)
AfterClientDialHandler func(*client.Client)
BeforeClientCloseHandler func(*client.Client)
AfterClientCloseHandler func(*client.Client)
UnaryClientInterceptorHandlers []grpc.UnaryClientInterceptor
StreamClientInterceptorHandlers []grpc.StreamClientInterceptor
ServiceAlertStartedHandler func()
ServiceAlertSkippedHandler func(reason string)
ServiceAlertStoppedHandler func(reason string)
ServiceHostOnlineHandler func(host string, port uint)
ServiceHostOfflineHandler func(host string, port uint)
// contains filtered or unexported fields
}
func NewNotifierClient ¶
func NewNotifierClient(appName string, configFileName string, customConfigPath string) *NotifierClient
NewNotifierClient creates a new prepared notifier client for use in service discovery notification
func (*NotifierClient) Close ¶
func (n *NotifierClient) Close()
Close will disconnect the notifier client from the notifier server
func (*NotifierClient) ConfiguredForNotifierClientDial ¶
func (n *NotifierClient) ConfiguredForNotifierClientDial() bool
ConfiguredForNotifierClientDial checks if the notifier client is configured for options, where Dial can be attempted to invoke
func (*NotifierClient) ConfiguredSNSDiscoveryTopicArn ¶
func (n *NotifierClient) ConfiguredSNSDiscoveryTopicArn() string
ConfiguredSNSDiscoveryTopicArn gets the topicArn defined for the notifier client service discovery endpoints
func (*NotifierClient) Dial ¶
func (n *NotifierClient) Dial() error
Dial will connect the notifier client to the notifier server
func (*NotifierClient) NotifierClientAlertServicesStarted ¶
func (n *NotifierClient) NotifierClientAlertServicesStarted() bool
NotifierClientAlertServicesStarted indicates notifier client services started via Subscribe() action
func (*NotifierClient) Subscribe ¶
func (n *NotifierClient) Subscribe(topicArn string) error
Subscribe will subscribe this notifier client to a specified topicArn with sns, via notifier server; this subscription will also start the recurring loop to wait for notifier server stream data, for receiving service discovery host info; when service discovery host info is received, the appropriate ServiceHostOnlineHandler or ServiceHostOfflineHandler is triggered; calling the Close() or Unsubscribe() or receiving error conditions from notifier server will sever the long running service discovery process.
func (*NotifierClient) Unsubscribe ¶
func (n *NotifierClient) Unsubscribe() error
Unsubscribe will stop notification alert services and disconnect from subscription on notifier server