30 lines
660 B
Go
30 lines
660 B
Go
package subscribe
|
|
|
|
import "fmt"
|
|
|
|
type ChannelExistError struct {
|
|
Channel string
|
|
}
|
|
|
|
// Error returns the formatted configuration error.
|
|
func (cee ChannelExistError) Error() string {
|
|
return fmt.Sprintf("Subscriber: Channel[%q] is already subscribed.", cee.Channel)
|
|
}
|
|
|
|
type ChannelIsNotExistError struct {
|
|
Channel string
|
|
}
|
|
|
|
// Error returns the formatted configuration error.
|
|
func (cinee ChannelIsNotExistError) Error() string {
|
|
return fmt.Sprintf("Subscriber: Channel[%q] is not subscribed.", cinee.Channel)
|
|
}
|
|
|
|
type Subscriber interface {
|
|
Start() error
|
|
Stop() error
|
|
|
|
Subscribe(channel string) (chan<- *Message, error)
|
|
Unsubscribe(channel string) error
|
|
}
|