interchange

package
v0.0.0-...-aa333c5 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

interchange defines the core functionality of an Arke hub.

It provides an API for creating a new hub, publishing and subscribing, as well as appropriate interfaces for implementing transparent hub Client wrapper types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHub

func NewHub(ctx context.Context, cancel context.CancelFunc) *hub

NewHub builds an Arke hub.

Types

type Client

type Client interface {
	Publisher
	Subscriber
}

Client allows publication and subscription to an Arke hub.

func NewClient

func NewClient(h *hub) Client

NewClient creates a new Client for the given hub.

type Message

type Message struct {
	Encoding codex.Codex
	Source   string
	// Meta   map[string]string
	Body interface{}
}

Message constitutes the information exchanged across an Arke hub.

type Publisher

type Publisher interface {
	// Produce a message to the provided topic on the Arke hub.
	Publish(topic string, message Message) error
}

type Subscriber

type Subscriber interface {
	// Subscribe to a given topic.
	Subscribe(name, topic string, lease time.Duration) (<-chan Message, error)
}

Jump to

Keyboard shortcuts

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