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.
Package mqtt is a generated GoMock package.
Package mqtt is a generated GoMock package.
Index ¶
- type Config
- type Logger
- type MQTT
- func (m *MQTT) Close() error
- func (m *MQTT) CreateTopic(_ context.Context, topic string) error
- func (*MQTT) DeleteTopic(_ context.Context, _ string) error
- func (m *MQTT) Disconnect(waitTime uint) error
- 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 MockClient
- func (m *MockClient) AddRoute(arg0 string, arg1 mqtt.MessageHandler)
- func (m *MockClient) Connect() mqtt.Token
- func (m *MockClient) Disconnect(arg0 uint)
- func (m *MockClient) EXPECT() *MockClientMockRecorder
- func (m *MockClient) IsConnected() bool
- func (m *MockClient) IsConnectionOpen() bool
- func (m *MockClient) OptionsReader() mqtt.ClientOptionsReader
- func (m *MockClient) Publish(arg0 string, arg1 byte, arg2 bool, arg3 any) mqtt.Token
- func (m *MockClient) Subscribe(arg0 string, arg1 byte, arg2 mqtt.MessageHandler) mqtt.Token
- func (m *MockClient) SubscribeMultiple(arg0 map[string]byte, arg1 mqtt.MessageHandler) mqtt.Token
- func (m *MockClient) Unsubscribe(arg0 ...string) mqtt.Token
- type MockClientMockRecorder
- func (mr *MockClientMockRecorder) AddRoute(arg0, arg1 any) *gomock.Call
- func (mr *MockClientMockRecorder) Connect() *gomock.Call
- func (mr *MockClientMockRecorder) Disconnect(arg0 any) *gomock.Call
- func (mr *MockClientMockRecorder) IsConnected() *gomock.Call
- func (mr *MockClientMockRecorder) IsConnectionOpen() *gomock.Call
- func (mr *MockClientMockRecorder) OptionsReader() *gomock.Call
- func (mr *MockClientMockRecorder) Publish(arg0, arg1, arg2, arg3 any) *gomock.Call
- func (mr *MockClientMockRecorder) Subscribe(arg0, arg1, arg2 any) *gomock.Call
- func (mr *MockClientMockRecorder) SubscribeMultiple(arg0, arg1 any) *gomock.Call
- func (mr *MockClientMockRecorder) Unsubscribe(arg0 ...any) *gomock.Call
- type MockLogger
- func (m *MockLogger) Debug(args ...any)
- func (m *MockLogger) Debugf(format string, args ...any)
- func (m *MockLogger) EXPECT() *MockLoggerMockRecorder
- func (m *MockLogger) Errorf(format string, args ...any)
- func (m *MockLogger) Infof(format string, args ...any)
- func (m *MockLogger) Warnf(format string, args ...any)
- type MockLoggerMockRecorder
- func (mr *MockLoggerMockRecorder) Debug(args ...any) *gomock.Call
- func (mr *MockLoggerMockRecorder) Debugf(format any, args ...any) *gomock.Call
- func (mr *MockLoggerMockRecorder) Errorf(format any, args ...any) *gomock.Call
- func (mr *MockLoggerMockRecorder) Infof(format any, args ...any) *gomock.Call
- func (mr *MockLoggerMockRecorder) Warnf(format any, args ...any) *gomock.Call
- type MockMetrics
- type MockMetricsMockRecorder
- type MockPubSub
- func (m *MockPubSub) Disconnect(waitTime uint) error
- func (m *MockPubSub) EXPECT() *MockPubSubMockRecorder
- func (m *MockPubSub) Health() datasource.Health
- func (m *MockPubSub) Ping() error
- func (m *MockPubSub) Publish(ctx context.Context, topic string, message []byte) error
- func (m *MockPubSub) SubscribeWithFunction(topic string, subscribeFunc SubscribeFunc) error
- func (m *MockPubSub) Unsubscribe(topic string) error
- type MockPubSubMockRecorder
- func (mr *MockPubSubMockRecorder) Disconnect(waitTime any) *gomock.Call
- func (mr *MockPubSubMockRecorder) Health() *gomock.Call
- func (mr *MockPubSubMockRecorder) Ping() *gomock.Call
- func (mr *MockPubSubMockRecorder) Publish(ctx, topic, message any) *gomock.Call
- func (mr *MockPubSubMockRecorder) SubscribeWithFunction(topic, subscribeFunc any) *gomock.Call
- func (mr *MockPubSubMockRecorder) Unsubscribe(topic any) *gomock.Call
- type MockToken
- type MockTokenMockRecorder
- 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 MockClient ¶ added in v1.13.0
type MockClient struct {
// contains filtered or unexported fields
}
MockClient is a mock of Client interface.
func NewMockClient ¶ added in v1.13.0
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (*MockClient) AddRoute ¶ added in v1.13.0
func (m *MockClient) AddRoute(arg0 string, arg1 mqtt.MessageHandler)
AddRoute mocks base method.
func (*MockClient) Connect ¶ added in v1.13.0
func (m *MockClient) Connect() mqtt.Token
Connect mocks base method.
func (*MockClient) Disconnect ¶ added in v1.13.0
func (m *MockClient) Disconnect(arg0 uint)
Disconnect mocks base method.
func (*MockClient) EXPECT ¶ added in v1.13.0
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockClient) IsConnected ¶ added in v1.13.0
func (m *MockClient) IsConnected() bool
IsConnected mocks base method.
func (*MockClient) IsConnectionOpen ¶ added in v1.13.0
func (m *MockClient) IsConnectionOpen() bool
IsConnectionOpen mocks base method.
func (*MockClient) OptionsReader ¶ added in v1.13.0
func (m *MockClient) OptionsReader() mqtt.ClientOptionsReader
OptionsReader mocks base method.
func (*MockClient) Subscribe ¶ added in v1.13.0
func (m *MockClient) Subscribe(arg0 string, arg1 byte, arg2 mqtt.MessageHandler) mqtt.Token
Subscribe mocks base method.
func (*MockClient) SubscribeMultiple ¶ added in v1.13.0
func (m *MockClient) SubscribeMultiple(arg0 map[string]byte, arg1 mqtt.MessageHandler) mqtt.Token
SubscribeMultiple mocks base method.
func (*MockClient) Unsubscribe ¶ added in v1.13.0
func (m *MockClient) Unsubscribe(arg0 ...string) mqtt.Token
Unsubscribe mocks base method.
type MockClientMockRecorder ¶ added in v1.13.0
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
MockClientMockRecorder is the mock recorder for MockClient.
func (*MockClientMockRecorder) AddRoute ¶ added in v1.13.0
func (mr *MockClientMockRecorder) AddRoute(arg0, arg1 any) *gomock.Call
AddRoute indicates an expected call of AddRoute.
func (*MockClientMockRecorder) Connect ¶ added in v1.13.0
func (mr *MockClientMockRecorder) Connect() *gomock.Call
Connect indicates an expected call of Connect.
func (*MockClientMockRecorder) Disconnect ¶ added in v1.13.0
func (mr *MockClientMockRecorder) Disconnect(arg0 any) *gomock.Call
Disconnect indicates an expected call of Disconnect.
func (*MockClientMockRecorder) IsConnected ¶ added in v1.13.0
func (mr *MockClientMockRecorder) IsConnected() *gomock.Call
IsConnected indicates an expected call of IsConnected.
func (*MockClientMockRecorder) IsConnectionOpen ¶ added in v1.13.0
func (mr *MockClientMockRecorder) IsConnectionOpen() *gomock.Call
IsConnectionOpen indicates an expected call of IsConnectionOpen.
func (*MockClientMockRecorder) OptionsReader ¶ added in v1.13.0
func (mr *MockClientMockRecorder) OptionsReader() *gomock.Call
OptionsReader indicates an expected call of OptionsReader.
func (*MockClientMockRecorder) Publish ¶ added in v1.13.0
func (mr *MockClientMockRecorder) Publish(arg0, arg1, arg2, arg3 any) *gomock.Call
Publish indicates an expected call of Publish.
func (*MockClientMockRecorder) Subscribe ¶ added in v1.13.0
func (mr *MockClientMockRecorder) Subscribe(arg0, arg1, arg2 any) *gomock.Call
Subscribe indicates an expected call of Subscribe.
func (*MockClientMockRecorder) SubscribeMultiple ¶ added in v1.13.0
func (mr *MockClientMockRecorder) SubscribeMultiple(arg0, arg1 any) *gomock.Call
SubscribeMultiple indicates an expected call of SubscribeMultiple.
func (*MockClientMockRecorder) Unsubscribe ¶ added in v1.13.0
func (mr *MockClientMockRecorder) Unsubscribe(arg0 ...any) *gomock.Call
Unsubscribe indicates an expected call of Unsubscribe.
type MockLogger ¶ added in v1.13.0
type MockLogger struct {
// contains filtered or unexported fields
}
MockLogger is a mock of Logger interface.
func NewMockLogger ¶ added in v1.13.0
func NewMockLogger(ctrl *gomock.Controller) *MockLogger
NewMockLogger creates a new mock instance.
func (*MockLogger) Debug ¶ added in v1.13.0
func (m *MockLogger) Debug(args ...any)
Debug mocks base method.
func (*MockLogger) Debugf ¶ added in v1.13.0
func (m *MockLogger) Debugf(format string, args ...any)
Debugf mocks base method.
func (*MockLogger) EXPECT ¶ added in v1.13.0
func (m *MockLogger) EXPECT() *MockLoggerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockLogger) Errorf ¶ added in v1.13.0
func (m *MockLogger) Errorf(format string, args ...any)
Errorf mocks base method.
func (*MockLogger) Infof ¶ added in v1.13.0
func (m *MockLogger) Infof(format string, args ...any)
Infof mocks base method.
func (*MockLogger) Warnf ¶ added in v1.13.0
func (m *MockLogger) Warnf(format string, args ...any)
Warnf mocks base method.
type MockLoggerMockRecorder ¶ added in v1.13.0
type MockLoggerMockRecorder struct {
// contains filtered or unexported fields
}
MockLoggerMockRecorder is the mock recorder for MockLogger.
func (*MockLoggerMockRecorder) Debug ¶ added in v1.13.0
func (mr *MockLoggerMockRecorder) Debug(args ...any) *gomock.Call
Debug indicates an expected call of Debug.
func (*MockLoggerMockRecorder) Debugf ¶ added in v1.13.0
func (mr *MockLoggerMockRecorder) Debugf(format any, args ...any) *gomock.Call
Debugf indicates an expected call of Debugf.
func (*MockLoggerMockRecorder) Errorf ¶ added in v1.13.0
func (mr *MockLoggerMockRecorder) Errorf(format any, args ...any) *gomock.Call
Errorf indicates an expected call of Errorf.
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 any, labels ...any) *gomock.Call
IncrementCounter indicates an expected call of IncrementCounter.
type MockPubSub ¶ added in v1.13.0
type MockPubSub struct {
// contains filtered or unexported fields
}
MockPubSub is a mock of PubSub interface.
func NewMockPubSub ¶ added in v1.13.0
func NewMockPubSub(ctrl *gomock.Controller) *MockPubSub
NewMockPubSub creates a new mock instance.
func (*MockPubSub) Disconnect ¶ added in v1.13.0
func (m *MockPubSub) Disconnect(waitTime uint) error
Disconnect mocks base method.
func (*MockPubSub) EXPECT ¶ added in v1.13.0
func (m *MockPubSub) EXPECT() *MockPubSubMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockPubSub) Health ¶ added in v1.13.0
func (m *MockPubSub) Health() datasource.Health
Health mocks base method.
func (*MockPubSub) Ping ¶ added in v1.13.0
func (m *MockPubSub) Ping() error
Ping mocks base method.
func (*MockPubSub) SubscribeWithFunction ¶ added in v1.13.0
func (m *MockPubSub) SubscribeWithFunction(topic string, subscribeFunc SubscribeFunc) error
SubscribeWithFunction mocks base method.
func (*MockPubSub) Unsubscribe ¶ added in v1.13.0
func (m *MockPubSub) Unsubscribe(topic string) error
Unsubscribe mocks base method.
type MockPubSubMockRecorder ¶ added in v1.13.0
type MockPubSubMockRecorder struct {
// contains filtered or unexported fields
}
MockPubSubMockRecorder is the mock recorder for MockPubSub.
func (*MockPubSubMockRecorder) Disconnect ¶ added in v1.13.0
func (mr *MockPubSubMockRecorder) Disconnect(waitTime any) *gomock.Call
Disconnect indicates an expected call of Disconnect.
func (*MockPubSubMockRecorder) Health ¶ added in v1.13.0
func (mr *MockPubSubMockRecorder) Health() *gomock.Call
Health indicates an expected call of Health.
func (*MockPubSubMockRecorder) Ping ¶ added in v1.13.0
func (mr *MockPubSubMockRecorder) Ping() *gomock.Call
Ping indicates an expected call of Ping.
func (*MockPubSubMockRecorder) Publish ¶ added in v1.13.0
func (mr *MockPubSubMockRecorder) Publish(ctx, topic, message any) *gomock.Call
Publish indicates an expected call of Publish.
func (*MockPubSubMockRecorder) SubscribeWithFunction ¶ added in v1.13.0
func (mr *MockPubSubMockRecorder) SubscribeWithFunction(topic, subscribeFunc any) *gomock.Call
SubscribeWithFunction indicates an expected call of SubscribeWithFunction.
func (*MockPubSubMockRecorder) Unsubscribe ¶ added in v1.13.0
func (mr *MockPubSubMockRecorder) Unsubscribe(topic any) *gomock.Call
Unsubscribe indicates an expected call of Unsubscribe.
type MockToken ¶ added in v1.13.0
type MockToken struct {
// contains filtered or unexported fields
}
MockToken is a mock of Token interface.
func NewMockToken ¶ added in v1.13.0
func NewMockToken(ctrl *gomock.Controller) *MockToken
NewMockToken creates a new mock instance.
func (*MockToken) Done ¶ added in v1.13.0
func (m *MockToken) Done() <-chan struct{}
Done mocks base method.
func (*MockToken) EXPECT ¶ added in v1.13.0
func (m *MockToken) EXPECT() *MockTokenMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockTokenMockRecorder ¶ added in v1.13.0
type MockTokenMockRecorder struct {
// contains filtered or unexported fields
}
MockTokenMockRecorder is the mock recorder for MockToken.
func (*MockTokenMockRecorder) Done ¶ added in v1.13.0
func (mr *MockTokenMockRecorder) Done() *gomock.Call
Done indicates an expected call of Done.
func (*MockTokenMockRecorder) Error ¶ added in v1.13.0
func (mr *MockTokenMockRecorder) Error() *gomock.Call
Error indicates an expected call of Error.
func (*MockTokenMockRecorder) Wait ¶ added in v1.13.0
func (mr *MockTokenMockRecorder) Wait() *gomock.Call
Wait indicates an expected call of Wait.
func (*MockTokenMockRecorder) WaitTimeout ¶ added in v1.13.0
func (mr *MockTokenMockRecorder) WaitTimeout(arg0 any) *gomock.Call
WaitTimeout indicates an expected call of WaitTimeout.