topic

package
v1.0.2-0...-5afca94 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

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