amqp

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consume

type Consume func() (io.Closer, <-chan amqp.Delivery, error)

Consume returns a channel of amqp.Delivery's and a related closer or an error

func DirectQueueConsume

func DirectQueueConsume(amqpDSN, queue string) (Consume, error)

DirectQueueConsume returns a Consume func that will connect to the provided AMQP server and create a queue for direct message delivery

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

Listener consumes messages from an queue

func NewListener

func NewListener(
	consume Consume,
	minReconnectInterval time.Duration,
	maxReconnectInterval time.Duration,
	logger goengine.Logger,
) (*Listener, error)

NewListener returns a new Listener

func (*Listener) Listen

func (l *Listener) Listen(ctx context.Context, trigger sql.ProjectionTrigger) error

Listen receives messages from a queue, transforms them into a sql.ProjectionNotification and calls the trigger

type NotificationChannel

type NotificationChannel interface {
	Publish(exchange, queue string, mandatory, immediate bool, msg amqp.Publishing) error
	Consume(queue, consumer string, autoAck, exclusive, noLocal, noWait bool, args amqp.Table) (<-chan amqp.Delivery, error)
	Qos(prefetchCount, prefetchSize int, global bool) error
}

NotificationChannel represents a channel for notifications

type NotificationPublisher

type NotificationPublisher struct {
	// contains filtered or unexported fields
}

NotificationPublisher is responsible of publishing a notification to queue

func NewNotificationPublisher

func NewNotificationPublisher(
	amqpDSN,
	queue string,
	minReconnectInterval time.Duration,
	maxReconnectInterval time.Duration,
	logger goengine.Logger,
	connection io.Closer,
	channel NotificationChannel,
) (*NotificationPublisher, error)

NewNotificationPublisher returns an instance of NotificationPublisher

func (*NotificationPublisher) Publish

func (p *NotificationPublisher) Publish(ctx context.Context, notification *sql.ProjectionNotification) error

Publish sends a ProjectionNotification to Queue

Jump to

Keyboard shortcuts

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