amqp-0.15.1: Client library for AMQP servers (currently only RabbitMQ)

Safe HaskellNone
LanguageHaskell98

Network.AMQP.Lifted

Synopsis

Documentation

consumeMsgs Source #

Arguments

:: MonadBaseControl IO m 
=> Channel 
-> Text

Specifies the name of the queue to consume from.

-> Ack 
-> ((Message, Envelope) -> m ()) 
-> m ConsumerTag 

consumeMsgs chan queueName ack callback subscribes to the given queue and returns a consumerTag. For any incoming message, the callback will be run. If ack == Ack you will have to acknowledge all incoming messages (see ackMsg and ackEnv)

NOTE: The callback will be run on the same thread as the channel thread (every channel spawns its own thread to listen for incoming data) so DO NOT perform any request on chan inside the callback (however, you CAN perform requests on other open channels inside the callback, though I wouldn't recommend it). Functions that can safely be called on chan are ackMsg, ackEnv, rejectMsg, recoverMsgs. If you want to perform anything more complex, it's a good idea to wrap it inside forkIO.

In addition, while the callback function ((Message, Envelope) -> m ()) has access to the captured state, all its side-effects in m are discarded.

consumeMsgs' Source #

Arguments

:: MonadBaseControl IO m 
=> Channel 
-> Text

Specifies the name of the queue to consume from.

-> Ack 
-> ((Message, Envelope) -> m ()) 
-> FieldTable 
-> m ConsumerTag 

an extended version of consumeMsgs that allows you to include arbitrary arguments.