Documentation
¶
Index ¶
- type Broker
- func (b *Broker) Broadcast(ctx context.Context, data interface{}, topic string, from string) map[string]bool
- func (b *Broker) Deny(ctx context.Context, id string, topic string)
- func (b *Broker) Exists(topic string, id string) bool
- func (b *Broker) ID(ctx context.Context) (id string)
- func (b *Broker) IdList(topic string) (idlist []string)
- func (b *Broker) Multicast(ctx context.Context, data interface{}, topic string, ids []string, from string) map[string]bool
- func (b *Broker) Push(data interface{}, topic string, id ...string) map[string]bool
- func (b *Broker) Unicast(ctx context.Context, data interface{}, topic string, id string, from string) bool
- type Callback
- type Message
- type MessageCache
- type Producer
- type Prosumer
- func (p *Prosumer) Broadcast(data interface{}, topic string) (map[string]bool, error)
- func (p *Prosumer) Client() *core.Client
- func (p *Prosumer) Exists(topic string, id string) (bool, error)
- func (p *Prosumer) ID() (id string)
- func (p *Prosumer) IdList(topic string) ([]string, error)
- func (p *Prosumer) Multicast(data interface{}, topic string, ids []string) (map[string]bool, error)
- func (p *Prosumer) Push(data interface{}, topic string, id ...string) (map[string]bool, error)
- func (p *Prosumer) SetID(id string)
- func (p *Prosumer) Subscribe(topic string, callback Callback) (result bool, err error)
- func (p *Prosumer) Unicast(data interface{}, topic string, id string) (bool, error)
- func (p *Prosumer) Unsubscribe(topic string) (result bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker struct {
*core.Service
Timeout time.Duration
HeartBeat time.Duration
OnSubscribe func(ctx context.Context, id string, topic string)
OnUnsubscribe func(ctx context.Context, id string, topic string, messages []Message)
// contains filtered or unexported fields
}
type MessageCache ¶
type MessageCache struct {
// contains filtered or unexported fields
}
func (*MessageCache) Append ¶
func (m *MessageCache) Append(message Message)
func (*MessageCache) Take ¶
func (m *MessageCache) Take() (result []Message)
type Producer ¶
type Producer interface {
From() string
Unicast(ctx context.Context, data interface{}, topic string, id string) bool
Multicast(ctx context.Context, data interface{}, topic string, ids []string) map[string]bool
Broadcast(ctx context.Context, data interface{}, topic string) map[string]bool
Push(data interface{}, topic string, id ...string) map[string]bool
Deny(ctx context.Context, id string, topic string)
Exists(topic string, id string) bool
IdList(topic string) []string
}
func GetProducer ¶
type Prosumer ¶
type Prosumer struct {
RetryInterval time.Duration
OnError func(error)
OnSubscribe func(topic string)
OnUnsubscribe func(topic string)
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.