Documentation ¶
Overview ¶
Package mqtt provides a client for interacting with MQTT message brokers.This package facilitates interaction with MQTT brokers, allowing publishing and subscribing to topics, managing subscriptions, and handling messages.
Package mqtt is a generated GoMock package.
Index ¶
- type Config
- type Logger
- type MQTT
- func (m *MQTT) CreateTopic(_ context.Context, topic string) error
- func (m *MQTT) DeleteTopic(_ context.Context, _ string) error
- func (m *MQTT) Disconnect(waitTime uint)
- func (m *MQTT) Health() datasource.Health
- func (m *MQTT) Ping() error
- func (m *MQTT) Publish(ctx context.Context, topic string, message []byte) error
- func (m *MQTT) Subscribe(ctx context.Context, topic string) (*pubsub.Message, error)
- func (m *MQTT) SubscribeWithFunction(topic string, subscribeFunc SubscribeFunc) error
- func (m *MQTT) Unsubscribe(topic string) error
- type Metrics
- type MockMetrics
- type MockMetricsMockRecorder
- type PubSub
- type SubscribeFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MQTT ¶
type MQTT struct { // contains filtered or unexported fields mqtt.Client // contains filtered or unexported fields }
MQTT is the struct that implements PublisherSubscriber interface to provide functionality for the MQTT as a pubsub.
func New ¶
New establishes a connection to MQTT Broker using the configs and return pubsub.MqttPublisherSubscriber with more MQTT focused functionalities related to subscribing(push), unsubscribing and disconnecting from broker.
func (*MQTT) DeleteTopic ¶
DeleteTopic is implemented to adhere to the PubSub Client interface Note: there is no concept of deletion.
func (*MQTT) Disconnect ¶
func (*MQTT) Health ¶
func (m *MQTT) Health() datasource.Health
func (*MQTT) SubscribeWithFunction ¶
func (m *MQTT) SubscribeWithFunction(topic string, subscribeFunc SubscribeFunc) error
SubscribeWithFunction subscribe with a subscribing function, called whenever broker publishes a message.
func (*MQTT) Unsubscribe ¶
type MockMetrics ¶
type MockMetrics struct {
// contains filtered or unexported fields
}
MockMetrics is a mock of Metrics interface.
func NewMockMetrics ¶
func NewMockMetrics(ctrl *gomock.Controller) *MockMetrics
NewMockMetrics creates a new mock instance.
func (*MockMetrics) EXPECT ¶
func (m *MockMetrics) EXPECT() *MockMetricsMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockMetrics) IncrementCounter ¶
func (m *MockMetrics) IncrementCounter(ctx context.Context, name string, labels ...string)
IncrementCounter mocks base method.
type MockMetricsMockRecorder ¶
type MockMetricsMockRecorder struct {
// contains filtered or unexported fields
}
MockMetricsMockRecorder is the mock recorder for MockMetrics.
func (*MockMetricsMockRecorder) IncrementCounter ¶
func (mr *MockMetricsMockRecorder) IncrementCounter(ctx, name interface{}, labels ...interface{}) *gomock.Call
IncrementCounter indicates an expected call of IncrementCounter.