Safe Haskell | None |
---|---|
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
Eq WorkerOptions Source # | |
Defined in Network.AMQP.Worker.Worker (==) :: WorkerOptions -> WorkerOptions -> Bool # (/=) :: WorkerOptions -> WorkerOptions -> Bool # | |
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 # |
data WorkerException e Source #
Exceptions created while processing
Instances
Eq e => Eq (WorkerException e) Source # | |
Defined in Network.AMQP.Worker.Worker (==) :: WorkerException e -> WorkerException e -> Bool # (/=) :: WorkerException e -> WorkerException e -> Bool # | |
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 # | |
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 # |