Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- type Config
- type Configs
- type Diagnostic
- type HandlerConfig
- type PahoClient
- type QoSLevel
- type Service
- func (s *Service) Alert(brokerName, topic string, qos QoSLevel, retained bool, message string) error
- func (s *Service) Close() error
- func (s *Service) Handler(c HandlerConfig, ctx ...keyvalue.T) (alert.Handler, error)
- func (s *Service) Open() error
- func (s *Service) Test(o interface{}) error
- func (s *Service) TestOptions() interface{}
- func (s *Service) Update(newConfigs []interface{}) error
Constants ¶
View Source
const DefaultQuiesceTimeout time.Duration = 250 * time.Millisecond
DefaultQuiesceTimeout is the duration the client will wait for outstanding messages to be published before forcing a disconnection
Variables ¶
View Source
var (
ErrInvalidQoS = errors.New("invalid QoS")
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { Connect() error Disconnect() Publish(topic string, qos QoSLevel, retained bool, message []byte) error }
Client describes an immutable MQTT client, designed to accommodate the incongruencies between real clients and mock clients.
type Config ¶
type Config struct { // Enabled indicates whether the service should be enabled Enabled bool `toml:"enabled" override:"enabled"` Name string `toml:"name" override:"name"` Default bool `toml:"default" override:"default"` // URL of the MQTT Broker. // Valid URLs include tcp://host:port, ws://host:port or ssl://host:port. // If using ssl://host:port, one must also specify the SSL configuration options. URL string `toml:"url" override:"url"` // Path to CA file SSLCA string `toml:"ssl-ca" override:"ssl-ca"` // Path to host cert file SSLCert string `toml:"ssl-cert" override:"ssl-cert"` // Path to cert key file SSLKey string `toml:"ssl-key" override:"ssl-key"` // Use SSL but skip chain & host verification InsecureSkipVerify bool `toml:"insecure-skip-verify" override:"insecure-skip-verify"` // ClientID is the unique ID advertised to the MQTT broker from this client. // Defaults to Name if empty. ClientID string `toml:"client-id" override:"client-id"` Username string `toml:"username" override:"username"` Password string `toml:"password" override:"password,redact"` // contains filtered or unexported fields }
func (*Config) SetNewClientF ¶
SetNewClientF sets the newClientF on a Config. It is used exclusively for testing.
type Diagnostic ¶
type Diagnostic interface { WithContext(ctx ...keyvalue.T) Diagnostic Error(msg string, err error) CreatingAlertHandler(c HandlerConfig) HandlingEvent() }
type HandlerConfig ¶
type PahoClient ¶
type PahoClient struct {
// contains filtered or unexported fields
}
func (*PahoClient) Connect ¶
func (p *PahoClient) Connect() error
func (*PahoClient) Disconnect ¶
func (p *PahoClient) Disconnect()
type QoSLevel ¶
type QoSLevel byte
QoSLevel indicates the quality of service for messages delivered to a broker.
func (QoSLevel) MarshalText ¶
func (*QoSLevel) UnmarshalText ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(cs Configs, d Diagnostic) (*Service, error)
func (*Service) TestOptions ¶
func (s *Service) TestOptions() interface{}
Click to show internal directories.
Click to hide internal directories.