summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolgerReinhardt <>2020-01-14 12:48:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2020-01-14 12:48:00 (GMT)
commitb63c40b0c6d63ecb7b0eea8b38d519292953eef5 (patch)
tree00412d4e24acc742e29fce9dcbebaf894b8f213d
parent247ef15a168ef709b430f3dedffa602de58ced1a (diff)
version 0.19.1HEAD0.19.1master
-rw-r--r--Network/AMQP.hs21
-rw-r--r--amqp.cabal2
-rwxr-xr-xchangelog.md4
3 files changed, 25 insertions, 2 deletions
diff --git a/Network/AMQP.hs b/Network/AMQP.hs
index eec7e07..aea8539 100644
--- a/Network/AMQP.hs
+++ b/Network/AMQP.hs
@@ -117,6 +117,8 @@ module Network.AMQP (
ackMsg,
ackEnv,
+ nackMsg,
+ nackEnv,
-- * Transactions
txSelect,
@@ -479,6 +481,24 @@ ackMsg chan deliveryTag multiple =
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 @@ fromURI' uri = (unEscapeString host, nport, unEscapeString (dropWhile (=='/') ui
uid = if null uid' then "guest" else uid'
pw = if null pw' then "guest" else pw'
host = if null hst' then "localhost" else hst'
-
diff --git a/amqp.cabal b/amqp.cabal
index 0bc7fab..239834b 100644
--- a/amqp.cabal
+++ b/amqp.cabal
@@ -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
diff --git a/changelog.md b/changelog.md
index b5ceb79..1ad95b2 100755
--- a/changelog.md
+++ b/changelog.md
@@ -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