publishmq

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 22 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

View Source
var (
	ErrInvalidTopic  = errors.New("invalid topic")
	ErrRequiredTopic = errors.New("topic is required")
	ErrInvalidData   = errors.New("data must be a valid JSON object")
)

Functions

func NewMessageHandler

func NewMessageHandler(eventHandler EventHandler, opts ...MessageHandlerOption) consumer.MessageHandler

func WithQueue

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

Types

type EventHandler

type EventHandler interface {
	Handle(ctx context.Context, event *models.Event) (*HandleResult, error)
}

func NewEventHandler

func NewEventHandler(
	logger *logging.Logger,
	deliveryMQ *deliverymq.DeliveryMQ,
	tenantStore tenantstore.TenantStore,
	eventTracer eventtracer.EventTracer,
	topics []string,
	topicsAllowWildcards bool,
	idempotence idempotence.Idempotence,
) EventHandler

type HandleResult added in v0.9.0

type HandleResult struct {
	EventID        string   `json:"id"`
	Duplicate      bool     `json:"duplicate"`
	DestinationIDs []string `json:"destination_ids"`
}

type MessageHandlerOption added in v1.6.0

type MessageHandlerOption func(*messageHandler)

func WithMaxRedeliveries added in v1.6.0

func WithMaxRedeliveries(maxRedeliveries int, counter RedeliveryCounter) MessageHandlerOption

WithMaxRedeliveries stops redelivering a message once it has failed maxRedeliveries+1 times: rejected where the broker supports it, acked otherwise. Without it, failed messages are redelivered without limit.

type PublishMQ

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

func New

func New(opts ...func(opts *PublishMQOption)) *PublishMQ

func (*PublishMQ) Subscribe

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

type PublishMQOption

type PublishMQOption struct {
	QueueConfig *mqs.QueueConfig
}

type PublishedEvent

type PublishedEvent struct {
	ID               string            `json:"id"`
	TenantID         string            `json:"tenant_id" binding:"required"`
	DestinationID    string            `json:"destination_id"`
	Topic            string            `json:"topic"`
	EligibleForRetry *bool             `json:"eligible_for_retry"`
	Time             time.Time         `json:"time"`
	Metadata         map[string]string `json:"metadata"`
	Data             json.RawMessage   `json:"data"`
}

type RedeliveryCounter added in v1.6.0

type RedeliveryCounter interface {
	Incr(ctx context.Context, messageKey string) (int64, error)
}

RedeliveryCounter counts failed receives per message.

func NewRedisRedeliveryCounter added in v1.6.0

func NewRedisRedeliveryCounter(client redis.Cmdable, deploymentID string) RedeliveryCounter

Jump to

Keyboard shortcuts

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