consumer

package
v0.0.0-...-99e48b3 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DirectExchangeType - тип direct
	DirectExchangeType ExchangeType = "direct"
	// FanoutExchangeType - тип fanout
	FanoutExchangeType = "fanout"
	// TopicExchangeType - тип topic
	TopicExchangeType = "topic"
)

Variables

This section is empty.

Functions

func Inst

func Inst() common.SendingService

Inst создает новый сервис получения сообщений

Types

type Binding

type Binding struct {
	// имя точки обмена и очереди
	Name string `yaml:"name"`

	// имя точки обмена
	Exchange string `yaml:"exchange"`

	// аргументы точки обмена
	ExchangeArgs amqp.Table

	// имя очереди
	Queue string `yaml:"queue"`

	// аргументы очереди
	QueueArgs amqp.Table

	// тип точки обмена
	Type ExchangeType `yaml:"type"`

	// ключ маршрутизации
	Routing string `yaml:"routing"`

	// количество потоков, разбирающих очередь
	Handlers int `yaml:"workers"`

	// количество сообщений, получаемых одновременно
	PrefetchCount int `yaml:"prefetchCount"`
	// contains filtered or unexported fields
}

Binding связка точки обмена и очереди

type Config

type Config struct {
	URI      string     `yaml:"uri"`
	Bindings []*Binding `yaml:"bindings"`
}

Config получатель сообщений из очереди

type Consumer

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

Consumer получатель сообщений из очереди

func NewConsumer

func NewConsumer(id int, connect *amqp.Connection, binding *Binding) *Consumer

NewConsumer создает нового получателя

type ErrorSign

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

ErrorSign признак ошибки

type ErrorSigns

type ErrorSigns []ErrorSign

ErrorSigns признаки ошибок

func (ErrorSigns) BindingType

func (e ErrorSigns) BindingType(message *common.MailMessage) FailureBindingType

BindingType отдает идентификатор очереди, в которую необходимо положить письмо с ошибкой

type ErrorSignsMap

type ErrorSignsMap map[int]ErrorSigns

ErrorSignsMap карта признаков ошибок, в качестве ключа используется код ошибки, полученной от почтового сервиса

func (ErrorSignsMap) BindingType

func (e ErrorSignsMap) BindingType(message *common.MailMessage) FailureBindingType

BindingType отдает идентификатор очереди, в которую необходимо положить письмо с ошибкой

type ExchangeType

type ExchangeType string

ExchangeType тип точки обмена

type FailureBindingType

type FailureBindingType int

FailureBindingType тип точки обмена для неотправленного письма

const (
	// RecipientFailureBindingType проблемы с адресатом
	RecipientFailureBindingType FailureBindingType = iota

	// TechnicalFailureBindingType технические проблемы: неверная последовательность команд, косяки с dns
	TechnicalFailureBindingType

	// ConnectionFailureBindingType проблемы с подключеним к почтовому сервису
	ConnectionFailureBindingType

	// UnknownFailureBindingType неизвестная проблема
	UnknownFailureBindingType
)

type Service

type Service struct {
	// настройка подписчиков на сообщения
	Configs []*Config `yaml:"consumers"`
	// contains filtered or unexported fields
}

Service сервис получения сообщений

func (*Service) Events

func (s *Service) Events() chan *common.SendEvent

Events канал для приема событий отправки писем

func (*Service) OnFinish

func (s *Service) OnFinish()

OnFinish останавливает получателей

func (*Service) OnInit

func (s *Service) OnInit(event *common.ApplicationEvent)

OnInit инициализирует сервис

func (*Service) OnPublish

func (s *Service) OnPublish(event *common.ApplicationEvent)

OnPublish перекладывает сообщения из очереди в очередь

func (*Service) OnRun

func (s *Service) OnRun()

OnRun запускает сервис

func (*Service) OnShowReport

func (s *Service) OnShowReport()

OnShowReport запускает получение сообщений с ошибками и пересылает их другому сервису

type Waiter

type Waiter struct {
	*time.Ticker
}

Waiter - ждун

Jump to

Keyboard shortcuts

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