queue

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 13, 2019 License: LGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DashPaymentConfirmation

type DashPaymentConfirmation struct {
	UserName         string `json:"user_name"`
	PaymentForwardID string `json:"payment_forward_id"`
	PaymentNumber    int64  `json:"payment_number"`
}

DashPaymentConfirmation is a message used to signal processing of a dash payment

type EmailSend

type EmailSend struct {
	Subject     string   `json:"subject"`
	Content     string   `json:"content"`
	ContentType string   `json:"content_type"`
	UserNames   []string `json:"user_names"`
	Emails      []string `json:"emails,omitempty"`
}

EmailSend is a helper struct used to contained formatted content ot send as an email

type EthPaymentConfirmation

type EthPaymentConfirmation struct {
	UserName      string `json:"user_name"`
	PaymentNumber int64  `json:"payment_number"`
}

EthPaymentConfirmation is a message used to confirm an ethereum based payment

type Manager

type Manager struct {
	ErrCh        chan *amqp.Error
	QueueName    Queue
	ExchangeName string
	// contains filtered or unexported fields
}

Manager is a helper struct to interact with rabbitmq

func New

func New(queue Queue, cfg *config.TemporalConfig, logger *zap.SugaredLogger, publish bool) (*Manager, error)

New is used to instantiate a new connection to rabbitmq as a publisher or consumer

func (*Manager) Close

func (qm *Manager) Close() error

Close is used to close our queue resources

func (*Manager) ConsumeMessages

func (qm *Manager) ConsumeMessages(ctx context.Context, wg *sync.WaitGroup, db *gorm.DB, cfg *config.TemporalConfig) error

ConsumeMessages is used to consume messages that are sent to the queue Question, do we really want to ack messages that fail to be processed? Perhaps the error was temporary, and we allow it to be retried?

func (*Manager) ProcessDASHPayment

func (qm *Manager) ProcessDASHPayment(ctx context.Context, wg *sync.WaitGroup, msgs <-chan amqp.Delivery) error

ProcessDASHPayment is used to process dash based payments

func (*Manager) ProcessETHPayment

func (qm *Manager) ProcessETHPayment(ctx context.Context, wg *sync.WaitGroup, msgs <-chan amqp.Delivery) error

ProcessETHPayment is used to process ethereum and rtc based payments

func (*Manager) PublishMessage

func (qm *Manager) PublishMessage(body interface{}) error

PublishMessage is used to produce messages that are sent to the queue, with a worker queue (one consumer)

func (*Manager) RegisterConnectionClosure

func (qm *Manager) RegisterConnectionClosure()

RegisterConnectionClosure is used to register a channel which we may receive connection level errors. This covers all channel, and connection errors.

type Queue

type Queue string

Queue is a typed string used to declare the various queue names

var (
	// EmailSendQueue is a queue used to handle sending email messages
	EmailSendQueue Queue = "email-send-queue"
	// DashPaymentConfirmationQueue is a queue used to handle confirming dash payments
	DashPaymentConfirmationQueue Queue = "dash-payment-confirmation-queue"
	// EthPaymentConfirmationQueue is a queue used to handle ethereum based payment confirmations
	EthPaymentConfirmationQueue Queue = "eth-payment-confirmation-queue"
	// ErrReconnect is an error emitted when a protocol connection error occurs
	// It is used to signal reconnect of queue consumers and publishers
	ErrReconnect = "protocol connection error, reconnect"
)

func (Queue) String

func (qt Queue) String() string

Jump to

Keyboard shortcuts

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