postmaster

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package postmaster provides email parsing, filtering, and dispatch orchestration.

Index

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

type QueueLookupFunc func(ctx context.Context, name string) (int, error)

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 Service

type Service struct {
	FilterChain filters.Chain
	Handler     Processor
}

Service wires connectors, filters, and ticket services together.

func (Service) Handle

func (s Service) Handle(ctx context.Context, msg *connector.FetchedMessage) error

Handle implements connector.Handler by running the filter chain then processor.

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

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.

Jump to

Keyboard shortcuts

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