pong

package module
v0.0.0-...-ec535a2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2017 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 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.

README

pong

An experimental library that abuses consul user events to create a distributed event bus.

Documentation

Index

Constants

View Source
const DefaultConsulUri = "http://localhost:8500"

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer struct {
	Handler func(msg *Message)
	// contains filtered or unexported fields
}

func (*Consumer) Address

func (c *Consumer) Address() string

type EventBus

type EventBus struct {
	*emission.Emitter

	Shutdown chan int
	// contains filtered or unexported fields
}

func NewEventBus

func NewEventBus(consulUri string) *EventBus

func (*EventBus) Consume

func (e *EventBus) Consume(address string, handler func(msg *Message)) *Consumer

func (*EventBus) Publish

func (e *EventBus) Publish(message *Message) (string, error)

func (*EventBus) Send

func (e *EventBus) Send(message *Message)

func (*EventBus) Start

func (e *EventBus) Start() error

func (*EventBus) Stop

func (e *EventBus) Stop()

type Message

type Message struct {
	Id      string                 `json:"id,omitempty"`
	Address string                 `json:"address"`
	Data    map[string]interface{} `json:"data,omitempty"`
}

func (*Message) Json

func (m *Message) Json() []byte

Directories

Path Synopsis
cli
pong command

Jump to

Keyboard shortcuts

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