Skip to content

Commit

Permalink
add ignore_processed example
Browse files Browse the repository at this point in the history
  • Loading branch information
smagafurov committed Jul 21, 2017
1 parent 0afcb18 commit 5651cba
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions aio_pika/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,15 @@ def process(self, requeue=False, reject_on_redelivered=False, ignore_processed=F
... # the message will be rejected
... print(message.body)
Example with ignore_processed=True
>>> def on_message_received(message: IncomingMessage):
... with message.process(ignore_processed=True):
... # Now (with ignore_processed=True) you may reject (or ack) message manually too
... if True: # some reasonable condition here
... message.reject()
... print(message.body)
:param requeue: Requeue message when exception.
:param reject_on_redelivered: When True message will be rejected only when message was redelivered.
:param ignore_processed: Do nothing if message already processed
Expand Down

0 comments on commit 5651cba

Please sign in to comment.