-
Notifications
You must be signed in to change notification settings - Fork 3
/
filr.py
49 lines (40 loc) · 927 Bytes
/
filr.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import boto
from kombu import BrokerConnection, Exchange, Queue, Consumer
connection = BrokerConnection()
connection.connect()
channel = connection.channel()
exchange = Exchange(
name="android",
type="fanout",
channel=channel,
durable=True,
)
exchange.declare()
channel = connection.channel()
queue = Queue(
name='filr',
exchange=exchange,
durable=True,
auto_delete=False,
channel=channel,
routing_key='filr',
)
queue.declare();
def fetch(b,m):
print b,m
consumer = Consumer(
channel=connection.channel(),
queues=queue,
auto_declare=False,
callbacks = [fetch]
)
consumer.consume(no_ack=False);
while(True):
connection.drain_events()
pass
#execfile('.private-settings')
#sdb = boto.connect_sdb(key_id, sec_key)
#domain = sdb.create_domain('android')
#item = domain.new_item('kral_step1')
#for key,value in kral_step.items():
# item[key] = value