Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type SESWorker = SESWorkerWith ()
- type SESWorkerWith a = Hworker (SESState a) (SESJob a)
- data SESState a = SESState {}
- data SESJob a = SESJob {
- sesEmTo :: Text
- sesEmSubj :: Text
- sesEmBodyText :: Maybe Text
- sesEmBodyHtml :: Maybe Text
- sesPayload :: Either Value a
- data SESConfig a = SESConfig {
- sesconfigName :: Text
- sesconfigLimit :: Int
- sesconfigSource :: Text
- sesconfigAfter :: SESJob a -> IO ()
- sesconfigLogger :: forall b. Show b => b -> IO ()
- sesconfigFailedQueueSize :: Int
- sesconfigRedisConnectInfo :: RedisConnection
- data RedisConnection :: *
- defaultSESConfig :: (ToJSON a, FromJSON a, Show a) => Text -> Int -> Text -> (SESJob a -> IO ()) -> SESConfig a
- create :: (ToJSON a, FromJSON a, Show a) => Text -> Int -> Text -> (SESJob a -> IO ()) -> IO (SESWorkerWith a)
- createWith :: (ToJSON a, FromJSON a, Show a) => SESConfig a -> IO (SESWorkerWith a)
- queue :: Job s t => Hworker s t -> t -> IO Bool
- worker :: Job s t => Hworker s t -> IO ()
- monitor :: Job s t => Hworker s t -> IO ()
- jobs :: Job s t => Hworker s t -> IO [t]
Documentation
type SESWorker = SESWorkerWith () Source #
SESJob | |
|
SESConfig | |
|
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 #
createWith :: (ToJSON a, FromJSON a, Show a) => SESConfig a -> 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.