Documentation
¶
Index ¶
Constants ¶
View Source
const (
DefaultDialTimeOut = 30
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageClient ¶ added in v1.0.3
type MessageClient interface {
// SetAuthData sets up message bus auth data
SetAuthData(secretProvider interfaces.SecretProvider) error
// Connect to messaging host specified in Mqtt5Config config
// returns error if not able to connect
Connect() error
// Disconnect is to close all connections on the message bus
Disconnect() error
// Subscribe is to receive messages from topics
// the function returns error for any subscribe error
Subscribe(topics []string, handlerType any) error
// Unsubscribe to unsubscribe from the specified topics.
Unsubscribe(topics []string) error
}
MessageClient is the messaging interface for publisher-subscriber pattern
type Mqtt5Client ¶
type Mqtt5Client struct {
// contains filtered or unexported fields
}
func NewMqtt5Client ¶
func NewMqtt5Client(logger log.Logger, ctx context.Context, config models.Mqtt5Config) Mqtt5Client
NewMqtt5Client create, initializes and returns new instance of Mqtt5Client
func (*Mqtt5Client) Connect ¶
func (c *Mqtt5Client) Connect() error
Connect establishes a connection to a MQTT server.
func (*Mqtt5Client) Disconnect ¶
func (c *Mqtt5Client) Disconnect() error
Disconnect closes the connection to the connected MQTT server.
func (*Mqtt5Client) SetAuthData ¶
func (c *Mqtt5Client) SetAuthData(secretProvider interfaces.SecretProvider) error
SetAuthData retrieves and sets up auth data from secret provider according to AuthMode and SecretName
func (*Mqtt5Client) Subscribe ¶ added in v1.0.3
func (c *Mqtt5Client) Subscribe(topics []string, handlerType any) error
Subscribe creates subscriptions for the specified topics and the message handler.
func (*Mqtt5Client) Unsubscribe ¶ added in v1.0.3
func (c *Mqtt5Client) Unsubscribe(topics []string) error
Unsubscribe to unsubscribe from the specified topics.
Click to show internal directories.
Click to hide internal directories.