Documentation
¶
Overview ¶
Package pubsub provides a pubsub implementation.
Index ¶
- func UUID() string
- type Message
- type PubSub
- type PublishError
- type Subscription
- type Topic
- func (t *Topic) Delete()
- func (t *Topic) Name() string
- func (t *Topic) NewSubscription(numGoroutines int) (*Subscription, error)
- func (t *Topic) Publish(ctx context.Context, msg *Message) error
- func (t *Topic) Stop()
- func (t *Topic) Subscription(name string) *Subscription
- func (t *Topic) Subscriptions() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PubSub ¶
type PubSub struct {
// contains filtered or unexported fields
}
PubSub is a Pub/Sub instance for a single project.
type PublishError ¶
PublishError is the error generated when it fails to publish a message.
func (PublishError) Error ¶
func (pe PublishError) Error() string
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
Subscription represents a PubSub subscription.
func (*Subscription) Delete ¶
func (s *Subscription) Delete()
Delete unsubscribes itself from topic.
func (*Subscription) Receive ¶
func (s *Subscription) Receive(f func(*Message))
Receive receives message for this subscription.
type Topic ¶
type Topic struct { // Errors is the error output channel back to the user. You MUST read from this // channel or the Publish will deadlock when the channel is full. Errors chan PublishError // contains filtered or unexported fields }
Topic represents a PubSub topic.
func (*Topic) NewSubscription ¶
func (t *Topic) NewSubscription(numGoroutines int) (*Subscription, error)
NewSubscription creates a new Subscription to this topic, numGoroutines is the number of goroutines it will spawn to pull msg concurrently.
func (*Topic) Subscription ¶
func (t *Topic) Subscription(name string) *Subscription
Subscription returns the subscription by name..
func (*Topic) Subscriptions ¶
Subscriptions list all the subscriptions to this topic.
Click to show internal directories.
Click to hide internal directories.