deliverymq

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMessageHandler

func NewMessageHandler(
	logger *logging.Logger,
	logMQ LogPublisher,
	tenantStore DestinationGetter,
	publisher Publisher,
	eventTracer DeliveryTracer,
	retryScheduler RetryScheduler,
	retryBackoff backoff.Backoff,
	retryMaxLimit int,
	idempotence idempotence.Idempotence,
	opts ...MessageHandlerOption,
) consumer.MessageHandler

func NewRetryScheduler

func NewRetryScheduler(deliverymq *DeliveryMQ, redisConfig *redis.RedisConfig, deploymentID string, pollBackoff time.Duration, logger *logging.Logger, eventGetter RetryEventGetter, opts ...RetrySchedulerOption) (scheduler.Scheduler, error)

func WithQueue

func WithQueue(queueConfig *mqs.QueueConfig) func(opts *DeliveryMQOption)

Types

type AttemptError added in v0.13.0

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

func (*AttemptError) Error added in v0.13.0

func (e *AttemptError) Error() string

func (*AttemptError) Unwrap added in v0.13.0

func (e *AttemptError) Unwrap() error

type DeliveryInfra

type DeliveryInfra interface {
	DeclareInfrastructure(ctx context.Context) error
}

type DeliveryMQ

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

func New

func New(opts ...func(opts *DeliveryMQOption)) *DeliveryMQ

func (*DeliveryMQ) Init

func (q *DeliveryMQ) Init(ctx context.Context) (func(), error)

func (*DeliveryMQ) Publish

func (q *DeliveryMQ) Publish(ctx context.Context, task models.DeliveryTask) error

func (*DeliveryMQ) Subscribe

func (q *DeliveryMQ) Subscribe(ctx context.Context, opts ...mqs.SubscribeOption) (mqs.Subscription, error)

type DeliveryMQOption

type DeliveryMQOption struct {
	QueueConfig *mqs.QueueConfig
}

type DeliveryTracer

type DeliveryTracer interface {
	Deliver(ctx context.Context, task *models.DeliveryTask, destination *models.Destination) (context.Context, trace.Span)
}

type DestinationGetter

type DestinationGetter interface {
	RetrieveDestination(ctx context.Context, tenantID, destID string) (*models.Destination, error)
}

type LogPublisher

type LogPublisher interface {
	Publish(ctx context.Context, entry models.LogEntry) error
}

type MessageHandlerOption added in v1.8.0

type MessageHandlerOption func(*messageHandler)

MessageHandlerOption configures optional behavior of the delivery handler.

func WithRetryPolicyResolver added in v1.8.0

func WithRetryPolicyResolver(r RetryPolicyResolver) MessageHandlerOption

WithRetryPolicyResolver lets destination types override the global retry policy.

type PostDeliveryError

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

func (*PostDeliveryError) Error

func (e *PostDeliveryError) Error() string

func (*PostDeliveryError) Unwrap

func (e *PostDeliveryError) Unwrap() error

type PreDeliveryError

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

Error types to distinguish between different stages of delivery

func (*PreDeliveryError) Error

func (e *PreDeliveryError) Error() string

func (*PreDeliveryError) Unwrap

func (e *PreDeliveryError) Unwrap() error

type Publisher

type Publisher interface {
	PublishEvent(ctx context.Context, destination *models.Destination, event *models.Event) (*models.Attempt, error)
}

type RetryEventGetter added in v0.13.0

type RetryEventGetter interface {
	ListAttempt(ctx context.Context, request logstore.ListAttemptRequest) (logstore.ListAttemptResponse, error)
}

RetryEventGetter is the interface for fetching prior attempts from logstore. ListAttempt returns both the attempt and the associated event data.

type RetryPolicyResolver added in v1.8.0

type RetryPolicyResolver interface {
	RetryPolicy(destinationType string) (b backoff.Backoff, maxRetries int, ok bool)
}

RetryPolicyResolver gives a destination type its own retry policy; ok=false means the type uses the handler's global policy.

type RetryScheduler

type RetryScheduler interface {
	Schedule(ctx context.Context, task string, delay time.Duration, opts ...scheduler.ScheduleOption) error
	Cancel(ctx context.Context, taskID string) error
}

type RetrySchedulerOption added in v0.13.0

type RetrySchedulerOption func(*retrySchedulerConfig)

RetrySchedulerOption is a functional option for configuring the retry scheduler.

func WithRetryLookupBatch added in v1.7.0

func WithRetryLookupBatch(size int, wait time.Duration) RetrySchedulerOption

WithRetryLookupBatch batches the attempt lookups of retries executing at the same time into one log store query: it flushes at size lookups or wait after the first one. A size below 2 disables batching, as does a log store without batch support.

func WithRetryMaxConcurrency added in v1.7.0

func WithRetryMaxConcurrency(n int) RetrySchedulerOption

WithRetryMaxConcurrency bounds concurrent retry executions per process. 0 means unbounded.

func WithRetryMaxReceiveCount added in v1.7.0

func WithRetryMaxReceiveCount(n uint64) RetrySchedulerOption

WithRetryMaxReceiveCount sets how many times a retry task is received before it is moved to the dead-letter queue.

func WithRetryNotReadyDelay added in v1.7.0

func WithRetryNotReadyDelay(d time.Duration) RetrySchedulerOption

WithRetryNotReadyDelay sets how long a retry waits when the attempt that triggered it is not in the log store yet; set it to the log flush interval.

func WithRetryVisibilityTimeout added in v0.13.0

func WithRetryVisibilityTimeout(vt uint) RetrySchedulerOption

WithRetryVisibilityTimeout sets the visibility timeout for the retry scheduler queue. This controls how long a message is hidden after being received before it becomes visible again (for retry if the executor returned an error).

type RetryTask added in v0.13.0

type RetryTask struct {
	EventID       string
	TenantID      string
	DestinationID string
	Telemetry     *models.DeliveryTelemetry
	// AttemptTime bounds the log store lookup; zero for tasks queued before
	// it was added.
	AttemptTime time.Time `json:",omitzero"`
}

RetryTask contains the minimal info needed to retry a delivery. The full Event data will be fetched from logstore when the retry executes.

func RetryTaskFromDeliveryTask added in v0.13.0

func RetryTaskFromDeliveryTask(task models.DeliveryTask, attemptTime time.Time) RetryTask

func (*RetryTask) FromString added in v0.13.0

func (m *RetryTask) FromString(str string) error

func (*RetryTask) ToDeliveryTask added in v0.13.0

func (m *RetryTask) ToDeliveryTask(event models.Event, attemptNumber int) models.DeliveryTask

func (*RetryTask) ToString added in v0.13.0

func (m *RetryTask) ToString() (string, error)

Jump to

Keyboard shortcuts

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