Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

using new multi_amqp connector class from python-amqp 5.1

  • Loading branch information...
commit b48de5c21ce593cc8db46e3c3c1b5b78ce85fff8 1 parent 42ca50f
Felix Richter authored
Showing with 5 additions and 12 deletions.
  1. +5 −12 src/main.py
View
17 src/main.py
@@ -7,23 +7,17 @@
PROTO_VERSION = 1
DESCRIPTION = 'Makes Statistics shiny'
-
# set up instances of needed modules
+
conf = gen.Configurator(PROTO_VERSION,DESCRIPTION)
-amqp1 = gen.auto_amqp()
-amqp2 = gen.auto_amqp()
+multi = gen.multi_amqp()
s = mail_shiny() # the magic mail parsing class
-conf.configure([amqp1,amqp2,s]) #set up parser and eval parsed stuff
+conf.configure([multi,s]) #set up parser and eval parsed stuff
-#TODO fix this thingy...
-amqp1.load_conf({'amqp' : {"in" : { "exchange" : "mail_stats"}}})
-amqp2.load_conf({'amqp' : {"in" : { "exchange" : "snmp_src"}}})
# start network connections
+amqp1,amqp2 = multi.create_connection()
s.create_connection()
-amqp1.create_connection()
-amqp2.create_connection()
-
# main method
def cb (ch,method,header,body):
log.debug ( "Header %r" % (header,))
@@ -40,6 +34,5 @@ def cb (ch,method,header,body):
try:
amqp1.start_loop()
except:
- amqp1.close_connection()
- amqp2.close_connection()
+ multi.close_connection()
s.close_connection()
Please sign in to comment.
Something went wrong with that request. Please try again.