Documentation
¶
Index ¶
- type ConsumerWithTimeout
- func (t *ConsumerWithTimeout) CancelMessages(ctx context.Context, messages []any) error
- func (t *ConsumerWithTimeout) CommitMessage(ctx context.Context, message any, preCommit func(ctx context.Context) error) error
- func (t *ConsumerWithTimeout) ReadMessages(ctx context.Context, limit int) (messages []any, err error)
- func (t *ConsumerWithTimeout) RejectMessage(ctx context.Context, message any, causeErr error) error
- type MessageProcessor
- type Option
- func WithCaption(value string) Option
- func WithCaptionPrefix(value string) Option
- func WithConsumerTimeout(read, write time.Duration) Option
- func WithHandlerTimeout(value time.Duration) Option
- func WithQueueSize(value int) Option
- func WithReadPeriod(value time.Duration) Option
- func WithReadyTimeout(value time.Duration) Option
- func WithSignalExecuteHandler(ch <-chan struct{}) Option
- func WithWorkersCount(value int) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsumerWithTimeout ¶ added in v0.29.0
type ConsumerWithTimeout struct {
// contains filtered or unexported fields
}
ConsumerWithTimeout - получатель сообщений с возможностью подтверждения их получения.
func NewConsumerWithTimeout ¶ added in v0.29.0
func NewConsumerWithTimeout(base mrworker.MessageConsumer, readTimeout, writeTimeout time.Duration) *ConsumerWithTimeout
NewConsumerWithTimeout - создаёт объект ConsumerWithTimeout.
func (*ConsumerWithTimeout) CancelMessages ¶ added in v0.29.0
func (t *ConsumerWithTimeout) CancelMessages(ctx context.Context, messages []any) error
CancelMessages - comment method.
func (*ConsumerWithTimeout) CommitMessage ¶ added in v0.29.0
func (t *ConsumerWithTimeout) CommitMessage(ctx context.Context, message any, preCommit func(ctx context.Context) error) error
CommitMessage - comment method.
func (*ConsumerWithTimeout) ReadMessages ¶ added in v0.29.0
func (t *ConsumerWithTimeout) ReadMessages(ctx context.Context, limit int) (messages []any, err error)
ReadMessages - comment method.
func (*ConsumerWithTimeout) RejectMessage ¶ added in v0.29.0
RejectMessage - comment method.
type MessageProcessor ¶
type MessageProcessor struct {
// contains filtered or unexported fields
}
MessageProcessor - многопоточный сервис обработки сообщений на основе консьюмера и обработчика.
func NewMessageProcessor ¶
func NewMessageProcessor( consumer mrworker.MessageConsumer, handler mrworker.MessageHandler, errorHandler mrcore.ErrorHandler, logger mrlog.Logger, traceManager traceManager, opts ...Option, ) *MessageProcessor
NewMessageProcessor - создаёт объект MessageProcessor.
func (*MessageProcessor) Caption ¶
func (p *MessageProcessor) Caption() string
Caption - возвращает название сервиса обработки сообщений.
func (*MessageProcessor) ReadyTimeout ¶ added in v0.27.0
func (p *MessageProcessor) ReadyTimeout() time.Duration
ReadyTimeout - возвращает максимальное время, за которое должен быть запущен сервис.
type Option ¶
type Option func(o *options)
Option - настройка объекта MessageProcessor.
func WithCaption ¶
WithCaption - устанавливает опцию caption для MessageProcessor.
func WithCaptionPrefix ¶ added in v0.29.0
WithCaptionPrefix - устанавливает опцию caption для JobWrapper.
func WithConsumerTimeout ¶ added in v0.29.0
WithConsumerTimeout - устанавливает опцию таймаута на время отмены чтения данных консьюмером при неожиданном завершении работы воркеров.
func WithHandlerTimeout ¶ added in v0.27.0
WithHandlerTimeout - устанавливает опцию handlerTimeout выполнения обработчика сообщения.
func WithQueueSize ¶
WithQueueSize - устанавливает опцию размера очереди обработки сообщений.
func WithReadPeriod ¶ added in v0.27.0
WithReadPeriod - устанавливает опцию периода чтения данных консьюмером, когда он в состоянии простоя.
func WithReadyTimeout ¶ added in v0.27.0
WithReadyTimeout - устанавливает опцию readyTimeout для MessageProcessor.
func WithSignalExecuteHandler ¶ added in v0.29.0
func WithSignalExecuteHandler(ch <-chan struct{}) Option
WithSignalExecuteHandler - comment func.
func WithWorkersCount ¶
WithWorkersCount - устанавливает опцию количества воркеров обрабатывающих сообщения.