publisher

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: May 4, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Publisher

type Publisher struct {
	Config      *models.RabbitSeasoning
	ChannelPool *pools.ChannelPool
	// contains filtered or unexported fields
}

Publisher contains everything you need to publish a message.

func NewPublisher

func NewPublisher(
	config *models.RabbitSeasoning,
	chanPool *pools.ChannelPool,
	connPool *pools.ConnectionPool) (*Publisher, error)

NewPublisher creates and configures a new Publisher.

func (*Publisher) AutoPublishStarted

func (pub *Publisher) AutoPublishStarted() bool

AutoPublishStarted allows you to see if the AutoPublish feature has started - is locking.

func (*Publisher) FlushStops

func (pub *Publisher) FlushStops()

FlushStops flushes out all the AutoStop messages.

func (*Publisher) Notifications

func (pub *Publisher) Notifications() <-chan *models.Notification

Notifications yields all the success and failures during all publish events. Highly recommend susbscribing to this. Buffer will block if not consumed and leave goroutines stuck.

func (*Publisher) Publish

func (pub *Publisher) Publish(letter *models.Letter)

Publish sends a single message to the address on the letter. Subscribe to Notifications to see success and errors.

func (*Publisher) PublishWithRetry

func (pub *Publisher) PublishWithRetry(letter *models.Letter)

PublishWithRetry sends a single message to the address on the letter with retry capabilities. Subscribe to Notifications to see success and errors. RetryCount is based on the letter property. Zero means it will try once.

func (*Publisher) QueueLetter

func (pub *Publisher) QueueLetter(letter *models.Letter)

QueueLetter queues up a letter that will be consumed by AutoPublish. Blocks on the Letter Buffer being full.

func (*Publisher) QueueLetters

func (pub *Publisher) QueueLetters(letters []*models.Letter)

QueueLetters allows you to bulk queue letters that will be consumed by AutoPublish. Blocks on the Letter Buffer being full.

func (*Publisher) Shutdown

func (pub *Publisher) Shutdown(shutdownPools bool)

Shutdown cleanly shutsdown the publisher and resets it's internal state.

func (*Publisher) StartAutoPublish

func (pub *Publisher) StartAutoPublish(allowRetry bool)

StartAutoPublish starts auto-publishing letters queued up - is locking.

func (*Publisher) StopAutoPublish

func (pub *Publisher) StopAutoPublish()

StopAutoPublish stops publishing letters queued up - is locking.

Jump to

Keyboard shortcuts

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