amqp-worker-0.4.0: Type-safe AMQP workers
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.AMQP.Worker.Worker

Synopsis

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

Constructors

WorkerOptions 

Fields