packages feed

amqp 0.19.0 → 0.19.1

raw patch · 3 files changed

+25/−2 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Network.AMQP: nackEnv :: Envelope -> IO ()
+ Network.AMQP: nackMsg :: Channel -> LongLongInt -> Bool -> Bool -> IO ()

Files

Network/AMQP.hs view
@@ -117,6 +117,8 @@ 
     ackMsg,
     ackEnv,
+    nackMsg,
+    nackEnv,
 
     -- * Transactions
     txSelect,
@@ -479,6 +481,24 @@ ackEnv :: Envelope -> IO ()
 ackEnv env = ackMsg (envChannel env) (envDeliveryTag env) False
 
+{- | @nackMsg chan deliveryTag multiple requeue@ rejects one or more messages. A message MUST not be rejected more than once.
+
+if @multiple==True@, the @deliverTag@ is treated as \"up to and including\", so that the client can reject multiple messages with a single method call. If @multiple==False@, @deliveryTag@ refers to a single message.
+
+If @requeue==True@, the server will try to requeue the message. If @requeue==False@, the message will be dropped by the server.
+-}
+nackMsg :: Channel -> LongLongInt -> Bool -> Bool -> IO ()
+nackMsg chan deliveryTag multiple requeue =
+    writeAssembly chan $ (SimpleMethod (Basic_nack
+        deliveryTag -- delivery_tag
+        multiple -- multiple
+        requeue -- requeue
+        ))
+
+-- | Reject a single message. This is a wrapper for 'nackMsg' in case you have the 'Envelope' at hand.
+nackEnv :: Envelope -> IO ()
+nackEnv env = nackMsg (envChannel env) (envDeliveryTag env) False False
+
 -- | @rejectMsg chan deliveryTag requeue@ allows a client to reject a message. It can be used to interrupt and cancel large incoming messages, or return untreatable  messages to their original queue. If @requeue==False@, the message will be discarded.  If it is 'True', the server will attempt to requeue the message.
 --
 -- NOTE: RabbitMQ 1.7 doesn't implement this command
@@ -689,4 +709,3 @@         uid   = if null uid'      then "guest" else uid'
         pw    = if null pw'       then "guest" else pw'
         host  = if null hst'      then "localhost" else hst'
-
amqp.cabal view
@@ -1,5 +1,5 @@ Name:                amqp
-Version:             0.19.0
+Version:             0.19.1
 Synopsis:            Client library for AMQP servers (currently only RabbitMQ)
 Description:         Client library for AMQP servers (currently only RabbitMQ)
 License:             BSD3
changelog.md view
@@ -1,3 +1,7 @@+### Version 0.19.1
+
+* add `nackMsg` and `nackEnv` methods
+
 ### Version 0.19.0
 
 * change `FVString` to be binary instead of UTF-8 encoded