[rhmessaging-commits] rhmessaging commits: r1390 - mgmt/bin.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Thu Nov 29 09:57:03 EST 2007
Author: justi9
Date: 2007-11-29 09:57:02 -0500 (Thu, 29 Nov 2007)
New Revision: 1390
Modified:
mgmt/bin/quirk
Log:
Minor fixes.
Modified: mgmt/bin/quirk
===================================================================
--- mgmt/bin/quirk 2007-11-29 14:51:02 UTC (rev 1389)
+++ mgmt/bin/quirk 2007-11-29 14:57:02 UTC (rev 1390)
@@ -1,8 +1,6 @@
#!/usr/bin/env python
import sys, qpid
-from qpid.client import Client
-from qpid.content import Content
class Exchange(object):
def __init__(self, session, name):
@@ -15,19 +13,21 @@
self.name = name
class Subscription(object):
- def __init__(self, session, queue, name):
+ def __init__(self, session, name, queue):
self.session = session
+ self.name = name
self.queue = queue
- self.name = name
# XXX what all does this do? it seems to declare things
# XXX what is the destination arg for?
+
# XXX from reading the spec, "destination" seems less
# appropriate than "subscription name" (which is what the spec
# ch. 25 docs say it is)
- session.csession.message_subscribe(queue="test", destination=self.name)
+ session.csession.message_subscribe(queue="test",
+ destination=self.name)
session.csession.message_flow(self.name, 0, 0xFFFFFFFF)
session.csession.message_flow(self.name, 1, 0xFFFFFFFF)
@@ -41,7 +41,7 @@
class Message(object):
def __init__(self, body=""):
- self.content = Content(body)
+ self.content = qpid.content.Content(body)
self.content["content_type"] = "text/plain"
def set_routing_key(self, key):
@@ -69,7 +69,7 @@
def declare(self, object):
if object.__class__ is Queue:
- #XXX blows up without queue=
+ # XXX blows up without queue=
self.csession.queue_declare(queue=object.name)
elif object.__class__ is Exchange:
self.csession.exchange_declare(exchange=object.name)
@@ -95,9 +95,11 @@
self.csession.message_transfer(destination="",
content=message.content)
+ else:
+ raise Exception()
def direct_with_explicit_exchange(host, port):
- client = Client(host, port)
+ client = qpid.client.Client(host, port)
client.start({"LOGIN": "guest", "PASSWORD": "guest"})
session = Session(client, client.session())
@@ -106,7 +108,7 @@
try:
q = Queue(session, "test")
e = Exchange(session, "amq.direct")
- s = Subscription(session, q, "s")
+ s = Subscription(session, "s", q)
session.declare(q)
session.bind(q, e)
@@ -116,7 +118,7 @@
m = Message("Test message " + str(i))
- # XXX make this an arg publish, instead?
+ # XXX make this an arg to publish, instead?
m.set_routing_key(q.name)
session.publish(m, e)
@@ -133,7 +135,7 @@
session.close()
def direct_with_implicit_exchange(host, port):
- client = Client(host, port)
+ client = qpid.client.Client(host, port)
client.start({"LOGIN": "guest", "PASSWORD": "guest"})
# Now, simpler, using the default exchange:
@@ -143,7 +145,7 @@
try:
q = Queue(session, "test")
- s = Subscription(session, q, "s")
+ s = Subscription(session, "s", q)
session.declare(q)
More information about the rhmessaging-commits
mailing list