topic

package
v2.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: Apache-2.0 Imports: 2 Imported by: 22 modules, 21 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package topic provides implementations of server-side topics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager is a struct responsible for finding topics. Topics are not created by the package user, rather they are created on demand by the topic manager.

func NewManager

func NewManager() *Manager

NewManager creates a new topic manager.

func (*Manager) Find

func (tm *Manager) Find(destination string) *Topic

Finds the topic for the given destination, and creates it if necessary.

type Subscription

type Subscription interface {
	// Send a message frame to the topic subscriber.
	SendTopicFrame(f *frame.Frame)
}

Subscription is the interface that wraps a subscriber to a topic.

type Topic

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

A Topic is used for broadcasting to subscribed clients. In contrast to a queue, when a message is sent to a topic, that message is transmitted to all subscribed clients.

func (*Topic) Enqueue

func (t *Topic) Enqueue(f *frame.Frame)

Enqueue send a message to the topic. All subscriptions receive a copy of the message.

func (*Topic) Subscribe

func (t *Topic) Subscribe(sub Subscription)

Subscribe adds a subscription to a topic. Any message sent to the topic will be transmitted to the subscription's client until unsubscription occurs.

func (*Topic) Unsubscribe

func (t *Topic) Unsubscribe(sub Subscription)

Unsubscribe causes a subscription to be removed from the topic.

Jump to

Keyboard shortcuts

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