blob: caf8783fae5d618848fa0470009dd70983e4f429 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package pubsub
// PubSub ...
type PubSub interface {
Publisher
Subscriber
Reader
}
// Subscriber defines the ability to operate as message passing broker.
type Subscriber interface {
// Subscribe broker to one or multiple topics.
Subscribe(topics ...string) error
// Unsubscribe from one or multiply topics
Unsubscribe(topics ...string) error
}
// Publisher publish one or more messages
type Publisher interface {
// Publish one or multiple Channel.
Publish(messages []*Message) error
// PublishAsync publish message and return immediately
// If error occurred it will be printed into the logger
PublishAsync(messages []*Message)
}
// Reader interface should return next message
type Reader interface {
Next() (*Message, error)
}
|