sender

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package sender provides an events sender, which is responsible for queuing the message queue for notifications and their sending.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	// Info logs a message with level Info on the standard logger.
	Info(context.Context, string, ...any)
	// Debug logs a message with level Debug on the standard logger.
	Debug(context.Context, string, ...any)
	// Warn logs a message with level Warn on the standard logger.
	Warn(context.Context, string, ...any)
	// Error logs a message with level Error on the standard logger.
	Error(context.Context, string, ...any)
}

Logger represents an interface of logger visible to the app.

type MessageBroker

type MessageBroker interface {
	// Consume opens a channel to receive messages from the message broker.
	// Returns data and error channels.
	Consume(context.Context) (<-chan []byte, <-chan error)
}

MessageBroker represents a universal message broker interface.

type Sender

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

Sender is responsible for queuing the message queue for notifications and their sending.

func NewSender

func NewSender(logger Logger, messageBrocker MessageBroker) (*Sender, error)

NewSender creates a new events sender after arguments validation.

func (*Sender) Start

func (s *Sender) Start(ctx context.Context) error

Start starts a goroutine which listens to the message queue and logs notifications.

func (*Sender) Wait

func (s *Sender) Wait(_ context.Context)

Wait waits for the sender goroutines to finish.

Jump to

Keyboard shortcuts

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