+def mq_notify(options, message):
+ options.section = 'dsa-udgenerate'
+ options.config = '/etc/dsa/pubsub.conf'
+
+ config = Config(options)
+ conf = {
+ 'rabbit_userid': config.username,
+ 'rabbit_password': config.password,
+ 'rabbit_virtual_host': config.vhost,
+ 'rabbit_hosts': ['pubsub02.debian.org', 'pubsub01.debian.org'],
+ 'use_ssl': False
+ }
+
+ msg = {
+ 'message': message,
+ 'timestamp': int(time.time())
+ }
+ conn = None
+ try:
+ conn = Connection(conf=conf)
+ conn.topic_send(config.topic,
+ json.dumps(msg),
+ exchange_name=config.exchange,
+ timeout=5)
+ finally:
+ if conn:
+ conn.close()
+