Files
mtusi2026lab5-fork/backend/internal/domain/outbox.go
T

29 lines
962 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package domain
import "time"
const (
OutboxAggregateAttachment = "attachment"
OutboxEventProcess = "attachment.process"
)
// OutboxEntry — намерение опубликовать сообщение, записанное
// в одной транзакции с бизнес-изменением (transactional outbox).
//
// Инварианты:
// - PublishedAt == nil => ещё не опубликовано, publisher обязан дослать;
// - PublishedAt != nil => RabbitMQ принял сообщение,
// а не «мы вызвали Publish». At-least-once: повторная доставка
// возможна и нормальна, гасится идемпотентностью consumer'а.
//
type OutboxEntry struct {
ID string
AggregateType string
AggregateID string
EventType string
Payload []byte
CreatedAt time.Time
PublishedAt *time.Time
Attempts int
}