gateway/subscribe/subscriber.go

30 lines
660 B
Go
Raw Permalink Normal View History

2018-04-09 11:37:54 +00:00
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
2018-04-09 13:14:26 +00:00
Subscribe(channel string) (<-chan *Message, error)
2018-04-09 11:37:54 +00:00
Unsubscribe(channel string) error
}