-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8faf6d7
commit c64a687
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import logging | ||
|
||
from amqpstorm import Connection | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
|
||
def consume_until_queue_is_empty(): | ||
with Connection('127.0.0.1', 'guest', 'guest') as connection: | ||
with connection.channel() as channel: | ||
while True: | ||
message = channel.basic.get('simple_queue') | ||
if not message: | ||
print('Queue is empty') | ||
break | ||
print(message.body) | ||
message.ack() | ||
|
||
|
||
if __name__ == '__main__': | ||
consume_until_queue_is_empty() |