mq

package
v0.0.0-...-9c05d5a Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2015 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMqClosing = logex.Define("mq is closing")
)

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Name  string
	Topic string
	// contains filtered or unexported fields
}

func NewChannel

func NewChannel(topic, name string, rat *internal.Rat) *Channel

func (*Channel) AddSubscriber

func (ch *Channel) AddSubscriber(s Subscriber)

func (*Channel) RemoveSubscriber

func (ch *Channel) RemoveSubscriber(s Subscriber) (idx int)

func (*Channel) Write

func (ch *Channel) Write(data []byte)

type Mq

type Mq struct {
	// contains filtered or unexported fields
}

func NewMq

func NewMq() *Mq

func (*Mq) Channels

func (m *Mq) Channels(topic string) (channels []string)

func (*Mq) Close

func (m *Mq) Close()

func (*Mq) GetTopic

func (m *Mq) GetTopic(name string) *Topic

func (*Mq) Publish

func (m *Mq) Publish(topic string, data []byte) error

func (*Mq) Subscribe

func (m *Mq) Subscribe(client Subscriber, topic, channel string)

func (*Mq) Topics

func (m *Mq) Topics() (topics []string)

func (*Mq) Unsubscribe

func (m *Mq) Unsubscribe(client Subscriber, topic, channel string)

type MqClient

type MqClient struct {
	RespChan chan *Msg
	StopChan chan struct{}
	// contains filtered or unexported fields
}

func NewMqClient

func NewMqClient(mq *Mq) *MqClient

func (*MqClient) Channels

func (c *MqClient) Channels(topic string) []string

func (*MqClient) Name

func (c *MqClient) Name() string

func (*MqClient) Publish

func (c *MqClient) Publish(topic string, msg []byte)

func (*MqClient) Stop

func (c *MqClient) Stop()

func (*MqClient) Subscribe

func (c *MqClient) Subscribe(topic, channel string) error

func (*MqClient) ToSelectCase

func (c *MqClient) ToSelectCase() *reflect.SelectCase

func (*MqClient) Topics

func (c *MqClient) Topics() []string

func (*MqClient) Unsubscribe

func (c *MqClient) Unsubscribe(topic, channel string) error

type Msg

type Msg struct {
	Id       MsgId
	Topic    string
	Attempts int
	Channel  string
	Data     []byte
}

func NewMsg

func NewMsg(topic string, data []byte) *Msg

func (Msg) Clone

func (m Msg) Clone(ch string) *Msg

func (*Msg) String

func (m *Msg) String() string

func (*Msg) TopicChannel

func (m *Msg) TopicChannel() *TopicChannel

type MsgId

type MsgId [16]byte

type Subscriber

type Subscriber interface {
	Name() string
	ToSelectCase() *reflect.SelectCase
}

type Topic

type Topic struct {
	Name string

	Chans      []*Channel
	ChanSelect []reflect.SelectCase
	EmptyChan  reflect.Value
	// contains filtered or unexported fields
}

func NewTopic

func NewTopic(name string, rat *internal.Rat) *Topic

func (*Topic) AddSubscriber

func (t *Topic) AddSubscriber(channel string, s Subscriber)

func (*Topic) GetChan

func (t *Topic) GetChan(name string) (ch *Channel)

func (*Topic) Publish

func (t *Topic) Publish(data []byte)

func (*Topic) RemoveSubscriber

func (t *Topic) RemoveSubscriber(channel string, s Subscriber)

type TopicChannel

type TopicChannel struct {
	Topic   string
	Channel string
}

func (*TopicChannel) String

func (t *TopicChannel) String() string

Jump to

Keyboard shortcuts

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