Documentation
¶
Index ¶
- func CollectMostOf[T any](ctx context.Context, count int) func(iter.Seq2[T, error]) iter.Seq2[T, error]
- func IteratorIsEmpty[T any](iterator iter.Seq2[T, error]) func(*testing.T)
- func MountSenders(r *message.Router, pub message.Publisher, sub message.Subscriber, ...)
- func NewConfirmationHandler(q Queue, s Confirmer, m Marshaler) message.NoPublishHandlerFunc
- func NewContinuousScanner(ctx context.Context, wg *errgroup.Group, q Queue, s Scheduler, ...)
- func NewProgressTracker(q Queue, report ProgressTracker) interface{ ... }
- func NewSender(s mdsend.Mailer) message.HandlerFunc
- func QueueRecognizesDuplicates(q Queue) func(*testing.T)
- func TestQueue(q Queue) func(*testing.T)
- type ChildCursor
- type Confirmation
- type Confirmer
- type ConfirmerFunc
- type ContinuousScannerOptions
- type Cursor
- type Marshaler
- type Process
- type Progress
- type ProgressTracker
- type ProgressTrackerFunc
- type Publisher
- type Queue
- type Scheduler
- type SchedulerFunc
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectMostOf ¶
func IteratorIsEmpty ¶
func MountSenders ¶
func MountSenders( r *message.Router, pub message.Publisher, sub message.Subscriber, topicPrefix string, senders ...mdsend.Mailer, )
TODO: deprecate?
func NewConfirmationHandler ¶
func NewConfirmationHandler( q Queue, s Confirmer, m Marshaler, ) message.NoPublishHandlerFunc
func NewContinuousScanner ¶
func NewProgressTracker ¶
func NewProgressTracker( q Queue, report ProgressTracker, ) interface { Queue Confirmer }
Types ¶
type ChildCursor ¶
type Confirmation ¶
type Confirmer ¶
type Confirmer interface {
ConfirmScheduling(context.Context, Confirmation) error
}
type ConfirmerFunc ¶
type ConfirmerFunc func(context.Context, Confirmation) error
func (ConfirmerFunc) ConfirmScheduling ¶
func (f ConfirmerFunc) ConfirmScheduling(ctx context.Context, c Confirmation) error
type Cursor ¶
Cursor holds the position of an item in a list from which an iterator can retrieve items sequentially. If Cursor.ItemID is empty, the iterator starts from the first batch. The item with the same ID is always skipped, so the iterator will start from the next item.
Cursor.Batch sets the maximum number of items to retrieve in one repository paging operation. A negative batch value iterates items in descending order from the Cursor.ItemID.
The iterator loads additional batches as needed as long as the range of items to retrieve is not exhausted.
Context cancellation will stop the iterator at the end of the current batch.
type Marshaler ¶
type Marshaler interface {
MarshalMessage(any) (*message.Message, error)
UnmarshalMessage(*message.Message, any) error
}
func NewMarshalerJSON ¶
func NewMarshalerJSON() Marshaler
type Progress ¶
func (Progress) EstimateRemaining ¶
func (Progress) MessagesPerMinute ¶
func (Progress) MessagesPerSecond ¶
type ProgressTracker ¶
type ProgressTrackerFunc ¶
func (ProgressTrackerFunc) TrackProgress ¶
func (f ProgressTrackerFunc) TrackProgress(ctx context.Context, p Progress)
type Queue ¶
type Queue interface {
CreateLetter(context.Context, mdsend.Letter) error
RetrieveLetter(context.Context, string) (mdsend.Letter, error)
MarkLetterAsSent(context.Context, string) (bool, error)
DeleteLetter(context.Context, string) error
CreateAttachment(context.Context, mdsend.Attachment) error
CreateMessage(context.Context, mdsend.Message) error
MarkMessagesAsScheduled(context.Context, string, ...string) error
MarkMessageAsSent(context.Context, string) (bool, error)
ListLetters(context.Context, Cursor) iter.Seq2[mdsend.Letter, error]
ListMessages(context.Context, ChildCursor) iter.Seq2[mdsend.Message, error]
ListAttachments(context.Context, string) iter.Seq2[mdsend.Attachment, error]
BeginTransaction(context.Context) (Queue, Transaction, error)
WithTransaction(context.Context, Transaction) (Queue, error)
}
type Scheduler ¶
type Scheduler interface {
ScheduleForDelivery(context.Context, mdsend.Letter, []mdsend.Message) error
}
func NewRoundRobinScheduler ¶
NewRoundRobinScheduler rotates through the provided schedulers on each scheduled messsage.
func NewSchedulerForPublisher ¶
NewSchedulerForPublisher returns a basic transaction-less scheduler. It marks the messsage as queued first to avoid duplicate deliveries. If the publisher fails to publish, the message is dropped. The sacrifice of consistency allows the scheduler to use the queue and publisher that do not use a compatible database driver.
Queue drivers sometimes provide a stricter scheduler.
type SchedulerFunc ¶
func (SchedulerFunc) ScheduleForDelivery ¶
type Transaction ¶
type Transaction interface {
Close(*error)
}