events

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Exchange names
	ExchangeDirect        = "customeros-direct"
	ExchangeCustomerOS    = "customeros"
	ExchangeNotifications = "notifications"
	ExchangeDeadLetter    = "dead-letter"

	// Notification queues
	QueueNotifications = "notifications"

	// CustomerOS queues
	QueueEvents     = "events"
	QueueOpensearch = "events-opensearch"
	QueueAgents     = "events-agents"

	// CustomerOS Direct queues
	QueueFlowParticipantSchedule = "events-flow-participant-schedule"

	// Dead Letter Queues
	DLQNotificatins            = QueueNotifications + "-dlq"
	DLQEvents                  = QueueEvents + "-dlq"
	DLQOpensearch              = QueueOpensearch + "-dlq"
	DLQAgents                  = QueueAgents + "-dlq"
	DLQFlowParticipantSchedule = QueueFlowParticipantSchedule + "-dlq"

	// CustomerOS Direct routing keys
	RoutingKeyFlowParticipantSchedule = "flow-participant-schedule"

	// Dead Letter routing key
	RoutingKeyDeadLetter = "dead-letter"

	// Default configurations
	DefaultMessageTTL          = 240 * time.Hour // after TTL message moves to DLQ
	DefaultMaxRetries          = 3
	DefaultPublishTimeout      = 5 * time.Second
	DefaultReconnectBackoff    = time.Second
	DefaultMaxReconnectBackoff = 30 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EventsService

type EventsService struct {
	Publisher *RabbitMQPublisher
}

func NewEventsService

func NewEventsService(rabbitmqURL string, log logger.Logger, publisherConfig *PublisherConfig) (*EventsService, error)

func (*EventsService) Close

func (s *EventsService) Close() error

type PublisherConfig

type PublisherConfig struct {
	MessageTTL          time.Duration
	MaxRetries          int
	PublishTimeout      time.Duration
	ReconnectBackoff    time.Duration
	MaxReconnectBackoff time.Duration
}

type RabbitMQPublisher

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

func NewRabbitMQPublisher

func NewRabbitMQPublisher(rabbitmqURL string, logger logger.Logger, config *PublisherConfig) (*RabbitMQPublisher, error)

func (*RabbitMQPublisher) Close

func (r *RabbitMQPublisher) Close() error

Close gracefully shuts down the publisher

func (*RabbitMQPublisher) PublishDirectEvent

func (r *RabbitMQPublisher) PublishDirectEvent(ctx context.Context, entityId string, entityType enum.EntityType, message interface{}) error

func (*RabbitMQPublisher) PublishFanoutEvent

func (r *RabbitMQPublisher) PublishFanoutEvent(ctx context.Context, entityId string, entityType enum.EntityType, message interface{}) error

Jump to

Keyboard shortcuts

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