jobqueue-0.0.15: A job queue library

Safe HaskellNone
LanguageHaskell98

Network.JobQueue.JobQueue

Synopsis

Documentation

data JobQueue e a Source

type FailureHandleFn a = Alert -> String -> String -> Maybe (Job a) -> IO (Maybe (Job a)) Source

data Session Source

A session handler

A session usually represents a database session to access job queues stored in the backend database.

data Unit a => Settings a Source

Job queue settings

Constructors

Settings 

Fields

failureHandleFn :: FailureHandleFn a

a function called when an action fails

afterExecuteFn :: AfterExecuteHandleFn a

a function called after an action is executed (for debugging)

Instances

Unit a => Default (Settings a) 

openSession Source

Arguments

:: String

a resource locator

-> IO Session

a session handler

Open a queue session with a resource locator

newSession Source

Arguments

:: String

a resource locator (dummy)

-> Backend 
-> Session

a session handler

Create a queue session with a backend handler

closeSession :: Session -> IO () Source

Close a queue session if needed

openJobQueue Source

Arguments

:: (Env e, Unit a) 
=> Session

a session handler

-> String

a queue name

-> Settings a

queue settings

-> JobM e a ()

a state machine definition

-> IO (JobQueue e a) 

Open a job queue with a session.

closeJobQueue :: (Env e, Unit a) => JobQueue e a -> IO () Source

Close a job queue.

countJobQueue :: (Env e, Unit a) => JobQueue e a -> IO Int Source

Count the number of jobs queued in a job queue.

resumeJobQueue :: (Env e, Unit a) => JobQueue e a -> IO Bool Source

Resume a job queue

suspendJobQueue :: forall e a. (Env e, Unit a) => JobQueue e a -> IO Bool Source

Suspend a job queue

executeJob :: (Env e, Unit a) => JobQueue e a -> e -> IO () Source

Execute an action of the head job in a job queue.

scheduleJob Source

Arguments

:: Unit a 
=> JobQueue e a

a job queue

-> a

a unit

-> IO () 

Schedule a job.

deleteJob Source

Arguments

:: Unit a 
=> JobQueue e a

a job queue

-> String

a job identifier

-> IO Bool 

Delete a job from a job queue.

clearJobs Source

Arguments

:: Unit a 
=> JobQueue e a

a job queue

-> IO [(String, Job a)] 

Clear all jobs from a job queue.

peekJob Source

Arguments

:: Unit a 
=> JobQueue e a

a job queue

-> IO (Maybe (Job a)) 

Peek a job form a job queue.