broker

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker interface {
	Publisher
	Initialize() error
	Consume(group *sync.WaitGroup)
	Disconnect() error
	Subscribe(exchange, routingKey string, handler Handler) error
}

Broker is the interface which defines the client connection(s) to a concrete broker like amqp

type Event

type Event interface {
	Message() *Message
	Ack()
	Nack(retry bool)
	QueueName() string
	RoutingKey() string
	SetContext(ctx context.Context)
}

Event abstraction

type Handler

type Handler func(event Event)

type Message

type Message struct {
	Context context.Context
	Body    []byte
}

Message is the core structure of the broker. It abstract's away the concrete broker message implementations (e.g. amqp.Delivery).

type Publisher

type Publisher interface {
	Publish(exchange, routingKey string, message *Message) error
}

Publisher can publish messages with a routingKey to the message-broker

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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