Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrClientNotInitialized = errors.New("client is not initialized") ErrMissingClientID = errors.New("missing client id") ErrMissingTopic = errors.New("missing topic") ErrFailedConnect = errors.New("failed to connect") ErrFailedDisconnect = errors.New("failed to disconnect") ErrFailedSubscribe = errors.New("failed to subscribe") ErrFailedUnsubscribe = errors.New("failed to unsubscribe") )
Functions ¶
func NewHandler ¶
func NewHandler(publisher messaging.Publisher, things domain.ThingsClient, svc Service, cache cache.ConnectionCache, logger logger.Logger) session.Handler
NewHandler creates new Handler entity
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 {
Total uint64
Subscriptions []Subscription
}
Page represents page metadata with content.
type PageMetadata ¶
PageMetadata contains page metadata that helps navigation.
type Repository ¶
type Repository interface {
// Save will save the subscription.
Save(ctx context.Context, sub Subscription) error
// RetrieveByGroup retrieves all subscriptions that belong to the specified group.
RetrieveByGroup(ctx context.Context, pm PageMetadata, groupID string) (Page, error)
// Remove will remove the subscription.
Remove(ctx context.Context, sub Subscription) error
// RemoveByThing removes all subscriptions associated with the specified thing ID.
RemoveByThing(ctx context.Context, thingID string) error
// RemoveByGroup removes all subscriptions associated with the specified group ID.
RemoveByGroup(ctx context.Context, groupID string) error
}
type Service ¶
type Service interface {
// ListSubscriptions lists all subscriptions that belong to the specified group.
ListSubscriptions(ctx context.Context, groupID, token 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
// RemoveSubscriptionsByThing removes all subscriptions associated with the specified thing ID.
RemoveSubscriptionsByThing(ctx context.Context, thingID string) error
// RemoveSubscriptionsByGroup removes all subscriptions associated with the specified group ID.
RemoveSubscriptionsByGroup(ctx context.Context, groupID string) 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 domain.AuthClient, things domain.ThingsClient, subscriptions Repository, cache cache.ConnectionCache, idp uuid.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.