Documentation
¶
Overview ¶
Package postmaster provides email parsing, filtering, and dispatch orchestration.
Index ¶
- type Processor
- type QueueLookupFunc
- type Result
- type Service
- type TicketProcessor
- type TicketProcessorOption
- func WithTicketProcessorArticleLookup(lookup articleFinder) TicketProcessorOption
- func WithTicketProcessorArticleStore(store articleStore) TicketProcessorOption
- func WithTicketProcessorAttachmentLimit(limit int64) TicketProcessorOption
- func WithTicketProcessorBodyLimit(limit int64) TicketProcessorOption
- func WithTicketProcessorDatabase(db *sql.DB) TicketProcessorOption
- func WithTicketProcessorFallbackQueue(queueID int) TicketProcessorOption
- func WithTicketProcessorLogger(logger *log.Logger) TicketProcessorOption
- func WithTicketProcessorMessageLookup(lookup messageTicketLookup) TicketProcessorOption
- func WithTicketProcessorQueueFinder(f queueFinder) TicketProcessorOption
- func WithTicketProcessorQueueLookup(fn QueueLookupFunc) TicketProcessorOption
- func WithTicketProcessorStorage(storage service.StorageService) TicketProcessorOption
- func WithTicketProcessorSystemUser(userID int) TicketProcessorOption
- func WithTicketProcessorTicketFinder(f ticketFinder) TicketProcessorOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Processor ¶
type Processor interface {
Process(ctx context.Context, msg *connector.FetchedMessage, meta *filters.MessageContext) (Result, error)
}
Processor orchestrates PostMaster-style parsing, filtering, and dispatching.
type QueueLookupFunc ¶
QueueLookupFunc resolves queue names to identifiers.
type Result ¶
type Result struct {
TicketID int
ArticleID int
Action string // new_ticket, follow_up, ignored, bounced, etc.
Err error
}
Result tracks what happened to a message.
type TicketProcessor ¶
type TicketProcessor struct {
// contains filtered or unexported fields
}
func NewTicketProcessor ¶
func NewTicketProcessor(tickets ticketCreator, opts ...TicketProcessorOption) *TicketProcessor
NewTicketProcessor builds a processor that creates new tickets for inbound messages.
func (*TicketProcessor) Process ¶
func (tp *TicketProcessor) Process(ctx context.Context, msg *connector.FetchedMessage, meta *filters.MessageContext) (Result, error)
Process parses the message and creates a ticket via the injected service.
type TicketProcessorOption ¶
type TicketProcessorOption func(*TicketProcessor)
TicketProcessorOption customizes TicketProcessor.
func WithTicketProcessorArticleLookup ¶
func WithTicketProcessorArticleLookup(lookup articleFinder) TicketProcessorOption
WithTicketProcessorArticleLookup provides access to created articles for attachment binding.
func WithTicketProcessorArticleStore ¶
func WithTicketProcessorArticleStore(store articleStore) TicketProcessorOption
WithTicketProcessorArticleStore wires the article repository used for follow-up inserts.
func WithTicketProcessorAttachmentLimit ¶
func WithTicketProcessorAttachmentLimit(limit int64) TicketProcessorOption
WithTicketProcessorAttachmentLimit overrides the maximum attachment bytes buffered in memory.
func WithTicketProcessorBodyLimit ¶
func WithTicketProcessorBodyLimit(limit int64) TicketProcessorOption
WithTicketProcessorBodyLimit constrains how much of the body is stored on create.
func WithTicketProcessorDatabase ¶
func WithTicketProcessorDatabase(db *sql.DB) TicketProcessorOption
WithTicketProcessorDatabase sets the database connection used for attachment metadata inserts.
func WithTicketProcessorFallbackQueue ¶
func WithTicketProcessorFallbackQueue(queueID int) TicketProcessorOption
WithTicketProcessorFallbackQueue overrides the queue used when accounts omit routing.
func WithTicketProcessorLogger ¶
func WithTicketProcessorLogger(logger *log.Logger) TicketProcessorOption
WithTicketProcessorLogger overrides the logger used for diagnostics.
func WithTicketProcessorMessageLookup ¶
func WithTicketProcessorMessageLookup(lookup messageTicketLookup) TicketProcessorOption
WithTicketProcessorMessageLookup wires the resolver used for References-based follow-ups.
func WithTicketProcessorQueueFinder ¶
func WithTicketProcessorQueueFinder(f queueFinder) TicketProcessorOption
WithTicketProcessorQueueFinder wires the queue repository used for follow-up policy checks.
func WithTicketProcessorQueueLookup ¶
func WithTicketProcessorQueueLookup(fn QueueLookupFunc) TicketProcessorOption
WithTicketProcessorQueueLookup wires a queue resolver for trusted header overrides.
func WithTicketProcessorStorage ¶
func WithTicketProcessorStorage(storage service.StorageService) TicketProcessorOption
WithTicketProcessorStorage wires the storage backend used for attachments.
func WithTicketProcessorSystemUser ¶
func WithTicketProcessorSystemUser(userID int) TicketProcessorOption
WithTicketProcessorSystemUser sets the user id used for ticket creation.
func WithTicketProcessorTicketFinder ¶
func WithTicketProcessorTicketFinder(f ticketFinder) TicketProcessorOption
WithTicketProcessorTicketFinder wires the ticket lookup used for follow-up detection.