hworker-ses-0.1.1.1: Library for sending email with Amazon's SES and hworker

Safe HaskellNone
LanguageHaskell2010

System.Hworker.SES

Synopsis

Documentation

data SESState a Source #

Constructors

SESState 

Fields

Instances

(ToJSON a, FromJSON a, Show a) => Job (SESState a) (SESJob a) Source # 

Methods

job :: SESState a -> SESJob a -> IO Result #

data SESJob a Source #

Instances

Show a => Show (SESJob a) Source # 

Methods

showsPrec :: Int -> SESJob a -> ShowS #

show :: SESJob a -> String #

showList :: [SESJob a] -> ShowS #

Generic (SESJob a) Source # 

Associated Types

type Rep (SESJob a) :: * -> * #

Methods

from :: SESJob a -> Rep (SESJob a) x #

to :: Rep (SESJob a) x -> SESJob a #

ToJSON a => ToJSON (SESJob a) Source # 
FromJSON a => FromJSON (SESJob a) Source # 
(ToJSON a, FromJSON a, Show a) => Job (SESState a) (SESJob a) Source # 

Methods

job :: SESState a -> SESJob a -> IO Result #

type Rep (SESJob a) Source # 

data RedisConnection :: * #

When configuring a worker, you can tell it to use an existing redis connection pool (which you may have for the rest of your application). Otherwise, you can specify connection info. By default, hworker tries to connect to localhost, which may not be true for your production application.

defaultSESConfig :: (ToJSON a, FromJSON a, Show a) => Text -> Int -> Text -> (SESJob a -> IO ()) -> SESConfig a Source #

create :: (ToJSON a, FromJSON a, Show a) => Text -> Int -> Text -> (SESJob a -> IO ()) -> IO (SESWorkerWith a) Source #

queue :: Job s t => Hworker s t -> t -> IO Bool #

Adds a job to the queue. Returns whether the operation succeeded.

worker :: Job s t => Hworker s t -> IO () #

Creates a new worker thread. This is blocking, so you will want to forkIO this into a thread. You can have any number of these (and on any number of servers); the more there are, the faster jobs will be processed.

monitor :: Job s t => Hworker s t -> IO () #

Start a monitor. Like worker, this is blocking, so should be started in a thread. This is responsible for retrying jobs that time out (which can happen if the processing thread is killed, for example). You need to have at least one of these running to have the retry happen, but it is safe to have any number running.

jobs :: Job s t => Hworker s t -> IO [t] #

Returns all pending jobs.