Documentation ¶
Index ¶
- type Attachment
- type Broker
- type Message
- type Options
- type Subscription
- type Subscriptions
- type Topic
- func (t *Topic) GetMessage(offset uint64) ([]byte, error)
- func (t *Topic) Name() string
- func (t *Topic) Offset() uint64
- func (t *Topic) Publish(b []byte)
- func (t *Topic) Subscribe(s *Subscription)
- func (t *Topic) SubscribeIfLatest(offset uint64, s *Subscription) bool
- func (t *Topic) Unsubscribe(s *Subscription)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
Broker manages the set of topics active on this node.
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
Subscription reads messages from the topic and sends to the connection.
func NewSubscription ¶
func NewSubscription(attachment Attachment, topic *Topic) (*Subscription, uint64)
NewSubscription creates a subscription to the given topic starting from the next message in the topic.
func NewSubscriptionFromOffset ¶
func NewSubscriptionFromOffset(attachment Attachment, topic *Topic, offset uint64) (*Subscription, uint64)
NewSubscriptionFromOffset creates a subscription to the given topic, starting at the next message after the given offset. If the offset is less than the earliest message retained by the topic, will subscribe from that earliest retained message.
func (*Subscription) Notify ¶
func (s *Subscription) Notify(m Message)
Notify notifys the subscriber about a new message.
func (*Subscription) Shutdown ¶
func (s *Subscription) Shutdown()
Shutdown unsubscribes and stops the send loop.
type Subscriptions ¶
type Subscriptions struct {
// contains filtered or unexported fields
}
func NewSubscriptions ¶
func NewSubscriptions(broker *Broker, attachment Attachment) *Subscriptions
func (*Subscriptions) AddSubscription ¶
func (s *Subscriptions) AddSubscription(topicName string) uint64
func (*Subscriptions) AddSubscriptionFromOffset ¶
func (s *Subscriptions) AddSubscriptionFromOffset(topicName string, lastOffset uint64) uint64
func (*Subscriptions) UnsubscribeAll ¶
func (s *Subscriptions) UnsubscribeAll()
type Topic ¶
type Topic struct {
// contains filtered or unexported fields
}
func (*Topic) GetMessage ¶
GetMessage returns the message with the given offset. If the offset is less than the earliest message, will round up to the next message.
func (*Topic) Subscribe ¶
func (t *Topic) Subscribe(s *Subscription)
func (*Topic) SubscribeIfLatest ¶
func (t *Topic) SubscribeIfLatest(offset uint64, s *Subscription) bool
func (*Topic) Unsubscribe ¶
func (t *Topic) Unsubscribe(s *Subscription)