consume

package
v0.29.2 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2025 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

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

func (t *ConsumerWithTimeout) RejectMessage(ctx context.Context, message any, causeErr error) error

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 - возвращает максимальное время, за которое должен быть запущен сервис.

func (*MessageProcessor) Shutdown

func (p *MessageProcessor) Shutdown(ctx context.Context) error

Shutdown - корректная остановка сервиса обработки сообщений.

func (*MessageProcessor) Start

func (p *MessageProcessor) Start(ctx context.Context, ready func()) error

Start - запуск сервиса обработки сообщений. Повторный запуск метода одно и того же объекта не предусмотрен, даже после вызова Shutdown.

type Option

type Option func(o *options)

Option - настройка объекта MessageProcessor.

func WithCaption

func WithCaption(value string) Option

WithCaption - устанавливает опцию caption для MessageProcessor.

func WithCaptionPrefix added in v0.29.0

func WithCaptionPrefix(value string) Option

WithCaptionPrefix - устанавливает опцию caption для JobWrapper.

func WithConsumerTimeout added in v0.29.0

func WithConsumerTimeout(read, write time.Duration) Option

WithConsumerTimeout - устанавливает опцию таймаута на время отмены чтения данных консьюмером при неожиданном завершении работы воркеров.

func WithHandlerTimeout added in v0.27.0

func WithHandlerTimeout(value time.Duration) Option

WithHandlerTimeout - устанавливает опцию handlerTimeout выполнения обработчика сообщения.

func WithQueueSize

func WithQueueSize(value int) Option

WithQueueSize - устанавливает опцию размера очереди обработки сообщений.

func WithReadPeriod added in v0.27.0

func WithReadPeriod(value time.Duration) Option

WithReadPeriod - устанавливает опцию периода чтения данных консьюмером, когда он в состоянии простоя.

func WithReadyTimeout added in v0.27.0

func WithReadyTimeout(value time.Duration) Option

WithReadyTimeout - устанавливает опцию readyTimeout для MessageProcessor.

func WithSignalExecuteHandler added in v0.29.0

func WithSignalExecuteHandler(ch <-chan struct{}) Option

WithSignalExecuteHandler - comment func.

func WithWorkersCount

func WithWorkersCount(value int) Option

WithWorkersCount - устанавливает опцию количества воркеров обрабатывающих сообщения.

Jump to

Keyboard shortcuts

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