{-# LANGUAGE FlexibleContexts #-}
module Network.AMQP.Lifted
( consumeMsgs
, consumeMsgs'
)
where
import qualified Network.AMQP as A
import Network.AMQP.Types
import Control.Monad.Trans.Control
import Data.Text (Text)
import Control.Monad
consumeMsgs :: MonadBaseControl IO m
=> A.Channel
-> Text
-> A.Ack
-> ((A.Message, A.Envelope) -> m ())
-> m A.ConsumerTag
consumeMsgs :: forall (m :: * -> *).
MonadBaseControl IO m =>
Channel -> Text -> Ack -> ((Message, Envelope) -> m ()) -> m Text
consumeMsgs Channel
chan Text
queueName Ack
ack (Message, Envelope) -> m ()
callback =
forall (b :: * -> *) (m :: * -> *) a.
MonadBaseControl b m =>
(RunInBase m b -> b a) -> m a
liftBaseWith forall a b. (a -> b) -> a -> b
$ \RunInBase m IO
runInIO ->
Channel -> Text -> Ack -> ((Message, Envelope) -> IO ()) -> IO Text
A.consumeMsgs Channel
chan Text
queueName Ack
ack (forall (f :: * -> *) a. Functor f => f a -> f ()
void forall b c a. (b -> c) -> (a -> b) -> a -> c
. RunInBase m IO
runInIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Message, Envelope) -> m ()
callback)
consumeMsgs' :: MonadBaseControl IO m
=> A.Channel
-> Text
-> A.Ack
-> ((A.Message, A.Envelope) -> m ())
-> (ConsumerTag -> m ())
-> FieldTable
-> m A.ConsumerTag
consumeMsgs' :: forall (m :: * -> *).
MonadBaseControl IO m =>
Channel
-> Text
-> Ack
-> ((Message, Envelope) -> m ())
-> (Text -> m ())
-> FieldTable
-> m Text
consumeMsgs' Channel
chan Text
queueName Ack
ack (Message, Envelope) -> m ()
callback Text -> m ()
cancelled FieldTable
args =
forall (b :: * -> *) (m :: * -> *) a.
MonadBaseControl b m =>
(RunInBase m b -> b a) -> m a
liftBaseWith forall a b. (a -> b) -> a -> b
$ \RunInBase m IO
runInIO ->
Channel
-> Text
-> Ack
-> ((Message, Envelope) -> IO ())
-> (Text -> IO ())
-> FieldTable
-> IO Text
A.consumeMsgs' Channel
chan Text
queueName Ack
ack (forall (f :: * -> *) a. Functor f => f a -> f ()
void forall b c a. (b -> c) -> (a -> b) -> a -> c
. RunInBase m IO
runInIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Message, Envelope) -> m ()
callback) (forall (f :: * -> *) a. Functor f => f a -> f ()
void forall b c a. (b -> c) -> (a -> b) -> a -> c
. RunInBase m IO
runInIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> m ()
cancelled) FieldTable
args