yesod-job-queue- Background jobs library for Yesod.

Safe HaskellNone



Background jobs library for Yesod. Use example is in



class (Yesod master, Read (JobType master), Show (JobType master), Enum (JobType master), Bounded (JobType master), JobInfo (JobType master)) => YesodJobQueue master where Source

Backend jobs for Yesod

Minimal complete definition

runJob, runDBJob, getJobState

Associated Types

type JobType master Source

Custom Job Type


runJob :: (MonadBaseControl IO m, MonadIO m) => master -> JobType master -> ReaderT master m () Source

Job Handler

queueConnectInfo :: master -> ConnectInfo Source

connection info for redis

queueKey :: master -> ByteString Source

queue key name for redis

threadNumber :: master -> Int Source

The number of threads to run the job

runDBJob :: (MonadBaseControl IO m, MonadIO m) => ReaderT (YesodPersistBackend master) (ReaderT master m) a -> ReaderT master m a Source

runDB for job

getJobState :: master -> JobState Source

get job state

jobAPIBaseUrl :: master -> String Source

get API and Manager base url

jobManagerJSUrl :: master -> String Source

get manager application javascript url (change only development)

getClassInformation :: master -> [JobQueueClassInfo] Source

get information of all type classes related job-queue

class JobInfo j where Source

description for JobType

Minimal complete definition



describe :: j -> String Source

startDequeue :: (YesodJobQueue master, MonadBaseControl IO m, MonadIO m) => master -> m () Source

enqueue :: YesodJobQueue master => master -> JobType master -> IO () Source

Add job to end of the queue

type JobState = TVar [RunningJob] Source

Manage the running jobs

newJobState :: IO (TVar [RunningJob]) Source

create new JobState