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: 0

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

Jump to

Keyboard shortcuts

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