broker

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 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
	Subscriber
	Initialize() error
	Disconnect() error
	Consume(group *sync.WaitGroup)
	HasConsumer() bool
}

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(requeue bool)
	Reject(requeue 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
	EnsureExchange(exchange string)
}

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

type Subscriber added in v1.1.3

type Subscriber interface {
	Subscribe(exchange, routingKey string, handler Handler) error
}

Subscriber can subscribe to exchanges with a routingKey

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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