Documentation ¶
Index ¶
Constants ¶
View Source
const ( SenMLContentType = "application/senml+json" CBORContentType = "application/senml+cbor" JSONContentType = "application/json" SenMLFormat = "senml" JSONFormat = "json" CBORFormat = "cbor" )
Variables ¶
View Source
var ( // ErrConnect indicates that connection to MQTT broker failed ErrConnect = errors.New("failed to connect to MQTT broker") // ErrPublishTimeout indicates that the publishing failed due to timeout. ErrPublishTimeout = errors.New("failed to publish due to timeout reached") // ErrSubscribeTimeout indicates that the subscription failed due to timeout. ErrSubscribeTimeout = errors.New("failed to subscribe due to timeout reached") // ErrUnsubscribeTimeout indicates that unsubscribe failed due to timeout. ErrUnsubscribeTimeout = errors.New("failed to unsubscribe due to timeout reached") // ErrUnsubscribeDeleteTopic indicates that unsubscribe failed because the topic was deleted. ErrUnsubscribeDeleteTopic = errors.New("failed to unsubscribe due to deletion of topic") // ErrNotSubscribed indicates that the topic is not subscribed to. ErrNotSubscribed = errors.New("not subscribed") // ErrEmptyTopic indicates the absence of topic. ErrEmptyTopic = errors.New("empty topic") // ErrMalformedSubtopic indicates that the subtopic is malformed. ErrMalformedSubtopic = errors.New("malformed subtopic") // ErrEmptyID indicates the absence of ID. ErrEmptyID = errors.New("empty ID") )
Functions ¶
func CreateMessage ¶
func CreateSubject ¶
func ExtractSubtopic ¶
Types ¶
type MessageHandler ¶
type MessageHandler interface { // Handle handles messages passed by underlying implementation. Handle(msg protomfx.Message) error // Cancel is used for cleanup during unsubscribing and it's optional. Cancel() error }
MessageHandler represents protomfx.Message handler for Subscriber.
type PubSub ¶
type PubSub interface { Publisher Subscriber }
PubSub represents aggregation interface for publisher and subscriber.
type Publisher ¶
type Publisher interface { // Publish publishes message to the message broker. Publish(msg protomfx.Message) error // Close gracefully closes message publisher's connection. Close() error }
Publisher specifies message publishing API.
type Subscriber ¶
type Subscriber interface { // Subscribe subscribes to the message stream and consumes messages. Subscribe(id, topic string, handler MessageHandler) error // Unsubscribe unsubscribes from the message stream and // stops consuming messages. Unsubscribe(id, topic string) error // Close gracefully closes message subscriber's connection. Close() error }
Subscriber specifies message subscription API.
Directories ¶
Path | Synopsis |
---|---|
Package mqtt hold the implementation of the Publisher and PubSub interfaces for the MQTT messaging system, the internal messaging broker of the Mainflux IoT platform.
|
Package mqtt hold the implementation of the Publisher and PubSub interfaces for the MQTT messaging system, the internal messaging broker of the Mainflux IoT platform. |
Package nats hold the implementation of the Publisher and PubSub interfaces for the NATS messaging system, the internal messaging broker of the Mainflux IoT platform.
|
Package nats hold the implementation of the Publisher and PubSub interfaces for the NATS messaging system, the internal messaging broker of the Mainflux IoT platform. |
Package rabbitmq holds the implementation of the Publisher and PubSub interfaces for the RabbitMQ messaging system, the internal messaging broker of the Mainflux IoT platform.
|
Package rabbitmq holds the implementation of the Publisher and PubSub interfaces for the RabbitMQ messaging system, the internal messaging broker of the Mainflux IoT platform. |
Click to show internal directories.
Click to hide internal directories.