mirror of
https://github.com/mainflux/mainflux.git
synced 2025-04-27 13:48:49 +08:00

* Move messaging to pkg Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Move errors to pkg Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Move Transformers to pkg Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Move SDK to pkg Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Remove Transformers from root Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Fix make proto Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Add copyrights header Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Fix CI Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Move Auth client to pkg Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Fix dependencies Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Update dependencies and vendors Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Fix CI Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
30 lines
797 B
Go
30 lines
797 B
Go
// Copyright (c) Mainflux
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package messaging
|
|
|
|
// Publisher specifies message publishing API.
|
|
type Publisher interface {
|
|
// Publishes message to the stream.
|
|
Publish(topic string, msg Message) error
|
|
}
|
|
|
|
// MessageHandler represents Message handler for Subscriber.
|
|
type MessageHandler func(msg Message) error
|
|
|
|
// Subscriber specifies message subscription API.
|
|
type Subscriber interface {
|
|
// Subscribe subscribes to the message stream and consumes messages.
|
|
Subscribe(topic string, handler MessageHandler) error
|
|
|
|
// Unsubscribe unsubscribes from the message stream and
|
|
// stops consuming messages.
|
|
Unsubscribe(topic string) error
|
|
}
|
|
|
|
// PubSub represents aggregation interface for publisher and subscriber.
|
|
type PubSub interface {
|
|
Publisher
|
|
Subscriber
|
|
}
|