Documentation ¶
Index ¶
Constants ¶
const ( // DirectExchangeType - тип direct DirectExchangeType ExchangeType = "direct" // FanoutExchangeType - тип fanout FanoutExchangeType = "fanout" // TopicExchangeType - тип topic TopicExchangeType = "topic" )
Variables ¶
This section is empty.
Functions ¶
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 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 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) OnInit ¶
func (s *Service) OnInit(event *common.ApplicationEvent)
OnInit инициализирует сервис
func (*Service) OnPublish ¶
func (s *Service) OnPublish(event *common.ApplicationEvent)
OnPublish перекладывает сообщения из очереди в очередь
func (*Service) OnShowReport ¶
func (s *Service) OnShowReport()
OnShowReport запускает получение сообщений с ошибками и пересылает их другому сервису