publisher

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: MIT Imports: 7 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AMQPChannel

type AMQPChannel interface {
	PublishWithContext(ctx context.Context, exchange, key string, mandatory, immediate bool, msg amqp.Publishing) error
	NotifyClose(receiver chan *amqp.Error) chan *amqp.Error
	NotifyFlow(c chan bool) chan bool
	Close() error
	NotifyPublish(confirm chan amqp.Confirmation) chan amqp.Confirmation
	Confirm(noWait bool) error
}

type AMQPConnection

type AMQPConnection interface {
}

type Connection

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

func NewConnection

func NewConnection(amqpConn AMQPConnection, closeCh chan struct{}) *Connection

func (*Connection) AMQPConnection

func (c *Connection) AMQPConnection() AMQPConnection

func (*Connection) NotifyClose

func (c *Connection) NotifyClose() chan struct{}

type Message

type Message struct {
	Context      context.Context
	Exchange     string
	Key          string
	Mandatory    bool
	Immediate    bool
	ErrOnUnready bool
	Publishing   amqp.Publishing
	ResultCh     chan error
}

type Option

type Option func(p *Publisher)

func WithConfirmation added in v0.16.0

func WithConfirmation(buffer uint) Option

WithConfirmation tells publisher to turn on publisher confirm mode. The buffer option tells how many messages might be in-flight. Once limit is reached no new messages could be published. The confirmation result is returned via msg.ResultCh.

func WithContext

func WithContext(ctx context.Context) Option

func WithInitFunc

func WithInitFunc(f func(conn AMQPConnection) (AMQPChannel, error)) Option

func WithLogger

func WithLogger(l logger.Logger) Option

func WithNotify added in v0.16.0

func WithNotify(stateCh chan State) Option

func WithRestartSleep

func WithRestartSleep(dur time.Duration) Option

type Publisher

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

func New

func New(
	connCh <-chan *Connection,
	opts ...Option,
) (*Publisher, error)

func (*Publisher) Close

func (p *Publisher) Close()

func (*Publisher) Go

func (p *Publisher) Go(msg Message) <-chan error

func (*Publisher) Notify added in v0.16.0

func (p *Publisher) Notify(stateCh chan State) <-chan State

func (*Publisher) NotifyClosed

func (p *Publisher) NotifyClosed() <-chan struct{}

func (*Publisher) Publish

func (p *Publisher) Publish(msg Message) error

type Ready added in v0.16.2

type Ready struct{}

type State added in v0.16.2

type State struct {
	Unready *Unready
	Ready   *Ready
}

type Unready added in v0.16.2

type Unready struct {
	Err error
}

Directories

Path Synopsis
Package mock_publisher is a generated GoMock package.
Package mock_publisher is a generated GoMock package.

Jump to

Keyboard shortcuts

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