client

package module
v0.0.0-...-3093ed6 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2014 License: MIT Imports: 6 Imported by: 1

README

CatalystZero Realtime Event Stream

This library provides a very simplified abstraction around amqp/rabbitmq which enables our micro-services to communicte asynchronously w/ each other.

See the example/ folder.

Documentation

Index

Constants

View Source
const (
	CONTENT_TYPE_JSON = "application/json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	GetCorrelationId() string

	// Parse parses the message into the given object.
	Parse(object interface{}) error

	Ack() error
	Nack(requeue bool) error
	Reject(requeue bool) error
}

type EventBus

type EventBus interface {
	// Start receiving events. Events are distributed in the current consumer-group, so not every consumer receives all events.
	Subscribe(eventName, consumerGroup string, autoAck bool) (Subscription, error)

	// Stops all subscribes and closes all internal connections
	Close() error

	// Publish sends the given payload to all consumers subscribed to the given event.
	Publish(eventName string, payload interface{}) error
}

func NewAmqpEventBus

func NewAmqpEventBus(url string) (EventBus, error)

func NewAmqpEventBusConfig

func NewAmqpEventBusConfig(url string, config amqp.Config) (EventBus, error)

type Subscription

type Subscription interface {
	Events() <-chan Event

	Close() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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