get rid of anyjson in rpc and fix bad reference to rpc.Connection

This commit is contained in:
Vishvananda Ishaya
2010-06-11 10:48:16 -07:00
parent 11441aa911
commit 671316ae6d

View File

@@ -18,12 +18,12 @@ AMQP-based RPC. Queues have consumers and publishers.
No fan-out support yet. No fan-out support yet.
""" """
import json
import logging import logging
import sys import sys
import uuid import uuid
from nova import vendor from nova import vendor
import anyjson
from carrot import connection from carrot import connection
from carrot import messaging from carrot import messaging
from twisted.internet import defer from twisted.internet import defer
@@ -198,7 +198,7 @@ def send_message(topic, message, wait=True):
_log.debug('message %s', message) _log.debug('message %s', message)
if wait: if wait:
consumer = messaging.Consumer(connection=rpc.Connection.instance(), consumer = messaging.Consumer(connection=Connection.instance(),
queue=msg_id, queue=msg_id,
exchange=msg_id, exchange=msg_id,
auto_delete=True, auto_delete=True,
@@ -206,7 +206,7 @@ def send_message(topic, message, wait=True):
routing_key=msg_id) routing_key=msg_id)
consumer.register_callback(generic_response) consumer.register_callback(generic_response)
publisher = messaging.Publisher(connection=rpc.Connection.instance(), publisher = messaging.Publisher(connection=Connection.instance(),
exchange="nova", exchange="nova",
exchange_type="topic", exchange_type="topic",
routing_key=topic) routing_key=topic)
@@ -219,4 +219,4 @@ def send_message(topic, message, wait=True):
# TODO: Replace with a docstring test # TODO: Replace with a docstring test
if __name__ == "__main__": if __name__ == "__main__":
send_message(sys.argv[1], anyjson.deserialize(sys.argv[2])) send_message(sys.argv[1], json.loads(sys.argv[2]))