Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddInitFunction ¶
func AddInitFunction(initFunc InitFunction)
AddInitFunction adds an init function that will be called on startup
func AddTaskFunction ¶
func AddTaskFunction(taskType string, taskFunc TaskFunction)
AddTaskFunction adds an task function that will be called for a type of task
Types ¶
type Config ¶
type Config struct { SentryDSN string `help:"the DSN used for logging errors to Sentry"` DB string `help:"URL describing how to connect to the RapidPro database"` DBPoolSize int `help:"the size of our db pool"` Redis string `help:"URL describing how to connect to Redis"` Version string `help:"the version of this mailroom install"` LogLevel string `help:"the logging level courier should use"` BatchWorkers int `help:"the number of go routines that will be used to handle batch events"` LibratoUsername string `help:"the username that will be used to authenticate to Librato"` LibratoToken string `help:"the token that will be used to authenticate to Librato"` }
Config is our top level configuration object
type Foreman ¶
type Foreman struct {
// contains filtered or unexported fields
}
Foreman takes care of managing our set of sending workers and assigns msgs for each to send
func NewForeman ¶
NewForeman creates a new Foreman for the passed in server with the number of max senders
func (*Foreman) Assign ¶
func (f *Foreman) Assign()
Assign is our main loop for the Foreman, it takes care of popping the next outgoing task from our backend and assigning them to workers
type InitFunction ¶
InitFunction is a function that will be called when mailroom starts
type Mailroom ¶
type Mailroom struct { Config *Config DB *sqlx.DB RedisPool *redis.Pool Quit chan bool CTX context.Context Cancel context.CancelFunc WaitGroup *sync.WaitGroup // contains filtered or unexported fields }
Mailroom is a service for handling RapidPro events
func NewMailroom ¶
NewMailroom creates and returns a new mailroom instance
type TaskFunction ¶
TaskFunction is the function that will be called for a type of task
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker is our type for a single goroutine that is handling queued events