amqp

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	URI               string
	MaxConnectRetries uint64
}

Config holds the configuration for the publisher/subscriber.

type PubSub

type PubSub struct {
	*lifecycle.Lifecycle
	Config
	// contains filtered or unexported fields
}

PubSub implements a publisher/subscriber that connects to an AMQP-compatible message queue.

func New

func New(cfg Config) *PubSub

New returns a new AMQP publisher/subscriber.

func (*PubSub) Close

func (p *PubSub) Close() error

Close stops the publisher/subscriber.

func (*PubSub) Publish

func (p *PubSub) Publish(topic string, messages ...*message.Message) error

Publish publishes the given messages to the given topic.

func (*PubSub) Subscribe

func (p *PubSub) Subscribe(ctx context.Context, topic string) (<-chan *message.Message, error)

Subscribe subscribes to a topic and returns the Go channel over which messages are sent. The returned channel will be closed when Close() is called on this struct.

func (*PubSub) SubscribeWithOpts

func (p *PubSub) SubscribeWithOpts(ctx context.Context, topic string,
	opts ...spi.Option) (<-chan *message.Message, error)

SubscribeWithOpts subscribes to a topic using the given options, and returns the Go channel over which messages are sent. The returned channel will be closed when Close() is called on this struct.

Jump to

Keyboard shortcuts

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