mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-06-20 21:04:24 -04:00
Some refactor/testing and utility scripts
This commit is contained in:
parent
e0a2917b81
commit
4e38a142d4
4 changed files with 61 additions and 10 deletions
21
bin/dump_queue.py
Executable file
21
bin/dump_queue.py
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env python
|
||||
from json import dumps, loads
|
||||
import os,sys,argparse, urllib.request, urllib.error, urllib.parse
|
||||
import websocket
|
||||
import time
|
||||
import uuid
|
||||
import logging
|
||||
import threading
|
||||
from kombu import Connection, Exchange, Queue
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
umbra_exchange = Exchange('umbra', 'direct', durable=True)
|
||||
requests_queue = Queue('requests', exchange=umbra_exchange)
|
||||
def print_and_ack(body, message):
|
||||
print(body)
|
||||
message.ack()
|
||||
|
||||
with Connection('amqp://guest:guest@localhost:5672//') as conn:
|
||||
with conn.Consumer(requests_queue, callbacks=[print_and_ack]) as consumer:
|
||||
while True:
|
||||
conn.drain_events()
|
Loading…
Add table
Add a link
Reference in a new issue