bus

package
v0.0.0-...-ac7f640 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BroadcastPublisher

type BroadcastPublisher interface {
	Broadcaster
	Publisher
}

BroadcastPublisher use when you need to publish & broadcast.

type Broadcaster

type Broadcaster interface {
	Broadcast(exchange, routingKey string, msg []byte) error
}

Broadcaster is an interface for broadcasting a message over a fanout channel. in other words, over rabbit's fanout exchange.

type Broker

type Broker struct {
	AmqpURL string
}

Broker wraps a rabbitmq functionality. It implements the publisher and broadcaster interfaces.

func NewBroker

func NewBroker(AmqpURL string) *Broker

NewBroker takes a rabbitmq host url and returns a broker struct

func (*Broker) Broadcast

func (b *Broker) Broadcast(exName, routingKey string, msg []byte) (err error)

Broadcast sends a message to a rabbitmq fanout exchange.

func (*Broker) Publish

func (b *Broker) Publish(qName string, msg []byte) (err error)

Publish sends a message to a rabbitmq server with default settings

type MockBroker

type MockBroker struct {
}

MockBroker implements the publisher/consumer interface but does nothing

func (MockBroker) Broadcast

func (m MockBroker) Broadcast(exName string, msg []byte) error

Broadcast satisfies the broadcaster interface. Does nothing.

func (MockBroker) Publish

func (m MockBroker) Publish(qName string, msg []byte) error

Publish satisfies the publisher interface. does nothing. Does nothing.

type Publisher

type Publisher interface {
	Publish(qName string, body []byte) error
}

Publisher wraps a message bus publish. In our case, rabbitmq's channel.Publish method.

Jump to

Keyboard shortcuts

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