Documentation ¶
Index ¶
Constants ¶
View Source
const ( LogInfoSubscribed = "subscribed with client_id %s to topics %s" LogInfoUnsubscribed = "unsubscribed client_id %s from topics %s" LogInfoConnected = "connected with client_id %s" LogInfoDisconnected = "disconnected client_id %s and username %s" LogInfoPublished = "published with client_id %s to the topic %s" LogErrFailedConnect = "failed to connect: " LogErrFailedSubscribe = "failed to subscribe: " LogErrFailedUnsubscribe = "failed to unsubscribe: " LogErrFailedPublish = "failed to publish: " LogErrFailedDisconnect = "failed to disconnect: " LogErrFailedPublishDisconnectEvent = "failed to publish disconnect event: " LogErrFailedPublishConnectEvent = "failed to publish connect event: " LogErrFailedPublishToMsgBroker = "failed to publish to mainflux message broker: " )
Variables ¶
View Source
var ( ErrMalformedSubtopic = errors.New("malformed subtopic") ErrClientNotInitialized = errors.New("client is not initialized") ErrMalformedTopic = errors.New("malformed topic") ErrMissingClientID = errors.New("client_id not found") ErrMissingTopicPub = errors.New("failed to publish due to missing topic") ErrMissingTopicSub = errors.New("failed to subscribe due to missing topic") ErrAuthentication = errors.New("failed to perform authentication over the entity") ErrSubscriptionAlreadyExists = errors.New("subscription already exists") )
Functions ¶
Types ¶
type Forwarder ¶
type Forwarder interface { // Forward subscribes to the Subscriber and // publishes messages using provided Publisher. Forward(id string, sub messaging.Subscriber, pub messaging.Publisher) error }
Forwarder specifies MQTT forwarder interface API.
type Page ¶
type Page struct { PageMetadata Subscriptions []Subscription }
Page represents page metadata with content.
type PageMetadata ¶
PageMetadata contains page metadata that helps navigation.
type Repository ¶
type Repository interface { // RetrieveByChannelID retrieves all subscriptions that belong to the specified channel. RetrieveByChannelID(ctx context.Context, pm PageMetadata, chanID string) (Page, error) // Save will save the subscription. Save(ctx context.Context, sub Subscription) error // Remove will remove the subscription. Remove(ctx context.Context, sub Subscription) error // Update will update the subscription status. UpdateStatus(ctx context.Context, sub Subscription) error // HasClientID will update the subscription status. HasClientID(ctx context.Context, clientID string) error }
type Service ¶
type Service interface { // ListSubscriptions lists all subscriptions that belong to the specified channel. ListSubscriptions(ctx context.Context, chanID, token, key string, pm PageMetadata) (Page, error) // CreateSubscription create a subscription. CreateSubscription(ctx context.Context, sub Subscription) error // RemoveSubscription removes the subscription having the provided identifier. RemoveSubscription(ctx context.Context, sub Subscription) error // HasClientID indicates if a subscription exist for a given client ID. HasClientID(ctx context.Context, clientID string) error // UpdateStatus updates the subscription status for a given client ID. UpdateStatus(ctx context.Context, sub Subscription) error }
Service specifies an API that must be fullfiled by the domain service implementation, and all of its decorators (e.g. logging & metrics).
func NewMqttService ¶
func NewMqttService(auth mainflux.AuthServiceClient, things mainflux.ThingsServiceClient, subscriptions Repository, idp mainflux.IDProvider) Service
NewMqttService instantiates the MQTT service implementation.
Directories ¶
Path | Synopsis |
---|---|
http
Package http contains implementation of kit service HTTP API.
|
Package http contains implementation of kit service HTTP API. |
Package redis contains cache implementations using Redis as the underlying database.
|
Package redis contains cache implementations using Redis as the underlying database. |
Click to show internal directories.
Click to hide internal directories.