pubsub

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2015 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TopicSyntax  = "(?P<protocol>mqtt|kfka)://(?P<host>[a-z0-9A-Z\\-]+(\\.[a-z0-9A-Z\\-]+)*)(:*(?P<port>[0-9]+))(?P<path>/.*)"
	BrokerSyntax = "(?P<protocol>mqtt|kfka)://(?P<host>[a-z0-9A-Z\\-]+(\\.[a-z0-9A-Z\\-]+)*)(:*(?P<port>[0-9]+))$"
)

Variables

View Source
var (
	ErrNotSupported = errors.New("not-supported")

	TopicRegex  = regexp.MustCompile(TopicSyntax)
	BrokerRegex = regexp.MustCompile(BrokerSyntax)
)

Functions

func GetReader

func GetReader(topic Topic, sub Subscriber) io.Reader

func GetWriter

func GetWriter(topic Topic, pub Publisher) io.Writer

func Register

func Register(protocol string, factory Factory)

Types

type Broker

type Broker string

func (Broker) HostPort

func (b Broker) HostPort() string

func (Broker) Protocol

func (b Broker) Protocol() string

func (Broker) PubSub

func (b Broker) PubSub(id string, options ...interface{}) (PubSub, error)

func (Broker) String

func (b Broker) String() string

func (Broker) Topic

func (b Broker) Topic(path string) Topic

func (Broker) Valid

func (b Broker) Valid() bool

type Factory

type Factory func(id, addr string, options ...interface{}) (PubSub, error)

type PubSub

type PubSub interface {
	Publisher
	Subscriber
	Close()
}

type Publisher

type Publisher interface {
	Publish(topic Topic, message []byte) error
}

type Subscriber

type Subscriber interface {
	Subscribe(topic Topic) (<-chan []byte, error)
}

type Topic

type Topic string

func (Topic) Broker

func (t Topic) Broker() Broker

func (Topic) HostPort

func (t Topic) HostPort() string

func (Topic) Path

func (t Topic) Path() string

func (Topic) Protocol

func (t Topic) Protocol() string

func (Topic) String

func (t Topic) String() string

func (Topic) Sub

func (t Topic) Sub(topic string) Topic

func (Topic) Valid

func (t Topic) Valid() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL