-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforwarder.py
29 lines (22 loc) · 885 Bytes
/
forwarder.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
import qpid
from qpid.messaging import *
from qpid.datatypes import uuid4
import sys
# Create connection and session
connection_src = Connection.establish("narcissus.rc.rit.edu:5672", username='guest', password='guest')
connection_dest = Connection.establish("ectet-esd3.rit.edu:5672", username="guest", password="guest")
session_src = connection_src.session()
session_dest = connection_dest.session()
recv = session_src.receiver("amq.topic/http_geojson; {create: always, delete: never, node: {durable: False}}")
send = session_dest.sender("nepotism_forwarder; {create:always, delete: never, node: {durable: False}}")
while True:
try:
message = recv.fetch()
# print message.content
session_src.acknowledge(message)
send.send(message.content)
except KeyboardInterrupt:
break
recv.close()
session_src.close(timeout=10)
print "Done"