Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- worker :: (FromJSON a, MonadIO m, MonadCatch m) => Connection -> WorkerOptions -> Queue a -> (WorkerException SomeException -> m ()) -> (Message a -> m ()) -> m ()
- data WorkerOptions = WorkerOptions {}
- data WorkerException e
Documentation
worker :: (FromJSON a, MonadIO m, MonadCatch m) => Connection -> WorkerOptions -> Queue a -> (WorkerException SomeException -> m ()) -> (Message a -> m ()) -> m () Source #
Create a worker which loops, checks for messages, and handles errors
startWorker conn queue = do Worker.worker conn def queue onError onMessage where onMessage :: Message User onMessage m = do putStrLn "handle user message" print (value m) onError :: WorkerException SomeException -> IO () onError e = do putStrLn "Do something with errors"
data WorkerOptions Source #
Options for worker
WorkerOptions | |
|
Instances
Show WorkerOptions Source # | |
Defined in Network.AMQP.Worker.Worker showsPrec :: Int -> WorkerOptions -> ShowS # show :: WorkerOptions -> String # showList :: [WorkerOptions] -> ShowS # | |
Default WorkerOptions Source # | |
Defined in Network.AMQP.Worker.Worker def :: WorkerOptions # | |
Eq WorkerOptions Source # | |
Defined in Network.AMQP.Worker.Worker (==) :: WorkerOptions -> WorkerOptions -> Bool # (/=) :: WorkerOptions -> WorkerOptions -> Bool # |
data WorkerException e Source #
Exceptions created while processing
Instances
Exception e => Exception (WorkerException e) Source # | |
Defined in Network.AMQP.Worker.Worker toException :: WorkerException e -> SomeException # fromException :: SomeException -> Maybe (WorkerException e) # displayException :: WorkerException e -> String # | |
Show e => Show (WorkerException e) Source # | |
Defined in Network.AMQP.Worker.Worker showsPrec :: Int -> WorkerException e -> ShowS # show :: WorkerException e -> String # showList :: [WorkerException e] -> ShowS # | |
Eq e => Eq (WorkerException e) Source # | |
Defined in Network.AMQP.Worker.Worker (==) :: WorkerException e -> WorkerException e -> Bool # (/=) :: WorkerException e -> WorkerException e -> Bool # |