You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2017/08/02 20:56:57 UTC
[1/2] qpid-cpp git commit: QPID-7875 qpid-route fetches links
multiple times when deleting routes
Repository: qpid-cpp
Updated Branches:
refs/heads/master 0e1cef52d -> edccbc9e1
QPID-7875 qpid-route fetches links multiple times when deleting routes
Project: http://git-wip-us.apache.org/repos/asf/qpid-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-cpp/commit/a8d392ef
Tree: http://git-wip-us.apache.org/repos/asf/qpid-cpp/tree/a8d392ef
Diff: http://git-wip-us.apache.org/repos/asf/qpid-cpp/diff/a8d392ef
Branch: refs/heads/master
Commit: a8d392efe30ef763d2e93c6ce733976ac786c0f0
Parents: 0e1cef5
Author: Chris Richardson <ch...@fourc.eu>
Authored: Tue Aug 1 15:12:59 2017 +0100
Committer: Gordon Sim <gs...@redhat.com>
Committed: Wed Aug 2 21:15:55 2017 +0100
----------------------------------------------------------------------
management/python/bin/qpid-route | 6 ------
1 file changed, 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-cpp/blob/a8d392ef/management/python/bin/qpid-route
----------------------------------------------------------------------
diff --git a/management/python/bin/qpid-route b/management/python/bin/qpid-route
index f51d249..f462bc1 100755
--- a/management/python/bin/qpid-route
+++ b/management/python/bin/qpid-route
@@ -397,9 +397,6 @@ class RouteManager:
if res.status != 0:
raise Exception("Error closing bridge: %d - %s" % (res.status, res.text))
if len(bridges) == 1 and config._dellink:
- link = self.getLink()
- if link == None:
- sys.exit(0)
if config._verbose:
print "Last bridge on link, closing link..."
res = link.close()
@@ -427,9 +424,6 @@ class RouteManager:
if res.status != 0:
raise Exception("Error closing bridge: %d - %s" % (res.status, res.text))
if len(bridges) == 1 and config._dellink:
- link = self.getLink()
- if link == None:
- sys.exit(0)
if config._verbose:
print "Last bridge on link, closing link..."
res = link.close()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/2] qpid-cpp git commit: QPID-7876 qpid-route does not properly
consider src-local when matching bridges
Posted by gs...@apache.org.
QPID-7876 qpid-route does not properly consider src-local when matching bridges
Project: http://git-wip-us.apache.org/repos/asf/qpid-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-cpp/commit/edccbc9e
Tree: http://git-wip-us.apache.org/repos/asf/qpid-cpp/tree/edccbc9e
Diff: http://git-wip-us.apache.org/repos/asf/qpid-cpp/diff/edccbc9e
Branch: refs/heads/master
Commit: edccbc9e1737603a1d1f66f0df8499dbba07e93b
Parents: a8d392e
Author: Chris Richardson <ch...@fourc.eu>
Authored: Tue Aug 1 21:03:30 2017 +0100
Committer: Gordon Sim <gs...@redhat.com>
Committed: Wed Aug 2 21:16:14 2017 +0100
----------------------------------------------------------------------
management/python/bin/qpid-route | 84 +++++++++++++++++++++--------------
1 file changed, 51 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-cpp/blob/edccbc9e/management/python/bin/qpid-route
----------------------------------------------------------------------
diff --git a/management/python/bin/qpid-route b/management/python/bin/qpid-route
index f462bc1..605bfd9 100755
--- a/management/python/bin/qpid-route
+++ b/management/python/bin/qpid-route
@@ -187,6 +187,12 @@ class RouteManager:
return link
return None
+ def getLinkName(self, link):
+ for prop, value in link.getProperties():
+ if prop.name == "name":
+ return value
+ return None
+
def checkLink(self, link):
retry = 3
while link is None or (link.state in ("Waiting", "Connecting", "Closing") and retry > 0):
@@ -331,53 +337,63 @@ class RouteManager:
if b[0] != self.local.name():
self.qmf.delBroker(b[1])
- def addRoute(self, remoteBroker, exchange, routingKey, tag, excludes, interbroker_mechanism="", dynamic=False):
- if dynamic and config._srclocal:
- raise Exception("--src-local is not permitted on dynamic routes")
-
- self.addLink(remoteBroker, interbroker_mechanism)
- link = self.getLink()
- self.checkLink(link)
-
+ def addBridge(self, link, src, dest, key, tag, excludes, srcIsQueue, srcIsLocal,
+ durable, dynamic, sync, credit):
bridges = self.agent.getObjects(_class="bridge")
for bridge in bridges:
if bridge.linkRef == link.getObjectId() and \
- bridge.dest == exchange and bridge.key == routingKey and not bridge.srcIsQueue:
+ bridge.dest == dest and bridge.src == src and bridge.srcIsQueue == srcIsQueue and \
+ bridge.srcIsLocal == srcIsLocal and bridge.dynamic == dynamic:
if not config._quiet:
- raise Exception("Duplicate Route - ignoring: %s(%s)" % (exchange, routingKey))
+ raise Exception("Duplicate Route - ignoring: %s(%s)" % (dest, key or src))
sys.exit(0)
if config._verbose:
print "Creating inter-broker binding..."
- res = link.bridge(config._durable, exchange, exchange, routingKey, tag,
- excludes, False, config._srclocal, dynamic,
- config._ack, credit=config._credit)
+
+ name = "%s:%s:%s:%s" % (dest, key or src, srcIsQueue, srcIsLocal)
+
+ brokers = self.agent.getObjects(_class="broker")
+ broker = brokers[0]
+ properties = {"link" : self.getLinkName(link),
+ "src" : src,
+ "dest" : dest,
+ "key" : key,
+ "tag" : tag,
+ "excludes" : excludes,
+ "srcIsQueue" : srcIsQueue,
+ "srcIsLocal" : srcIsLocal,
+ "durable" : durable,
+ "dynamic" : dynamic,
+ "sync" : sync,
+ "credit" : credit }
+ # Broker also decodes "queue" but this may be a mistake...? It's not a Bridge property in the QMF schema.
+
+ res = broker.create("bridge", name, properties, False)
if res.status != 0:
raise Exception(res.text)
if config._verbose:
print "Bridge method returned:", res.status, res.text
- def addQueueRoute(self, remoteBroker, interbroker_mechanism, exchange, queue ):
+ def addRoute(self, remoteBroker, exchange, routingKey, tag, excludes, interbroker_mechanism="", dynamic=False):
+ if dynamic and config._srclocal:
+ raise Exception("--src-local is not permitted on dynamic routes")
+
self.addLink(remoteBroker, interbroker_mechanism)
link = self.getLink()
self.checkLink(link)
- bridges = self.agent.getObjects(_class="bridge")
- for bridge in bridges:
- if bridge.linkRef == link.getObjectId() and \
- bridge.dest == exchange and bridge.src == queue and bridge.srcIsQueue:
- if not config._quiet:
- raise Exception("Duplicate Route - ignoring: %s(%s)" % (exchange, queue))
- sys.exit(0)
+ self.addBridge(link, exchange, exchange, routingKey, tag,
+ excludes, False, config._srclocal, config._durable, dynamic,
+ config._ack, config._credit)
- if config._verbose:
- print "Creating inter-broker binding..."
- res = link.bridge(config._durable, queue, exchange, "", "", "", True,
- config._srclocal, False, config._ack, credit=config._credit)
- if res.status != 0:
- raise Exception(res.text)
- if config._verbose:
- print "Bridge method returned:", res.status, res.text
+ def addQueueRoute(self, remoteBroker, interbroker_mechanism, exchange, queue):
+ self.addLink(remoteBroker, interbroker_mechanism)
+ link = self.getLink()
+ self.checkLink(link)
+
+ self.addBridge(link, queue, exchange, "", "", "", True, config._srclocal, config._durable, False,
+ config._ack, config._credit)
def delQueueRoute(self, remoteBroker, exchange, queue):
self.remote = BrokerURL(remoteBroker)
@@ -390,7 +406,8 @@ class RouteManager:
bridges = self.agent.getObjects(_class="bridge")
for bridge in bridges:
if bridge.linkRef == link.getObjectId() and \
- bridge.dest == exchange and bridge.src == queue and bridge.srcIsQueue:
+ bridge.dest == exchange and bridge.src == queue and bridge.srcIsQueue and \
+ bridge.srcIsLocal == config._srclocal:
if config._verbose:
print "Closing bridge..."
res = bridge.close()
@@ -417,7 +434,7 @@ class RouteManager:
bridges = self.agent.getObjects(_class="bridge")
for bridge in bridges:
if bridge.linkRef == link.getObjectId() and bridge.dest == exchange and bridge.key == routingKey \
- and bridge.dynamic == dynamic:
+ and bridge.dynamic == dynamic and bridge.srcIsLocal == config._srclocal:
if config._verbose:
print "Closing bridge..."
res = bridge.close()
@@ -447,8 +464,9 @@ class RouteManager:
if bridge.dynamic:
keyText = "<dynamic>"
else:
- keyText = bridge.key
- print "%s %s:%d %s %s" % (self.local.name(), myLink.host, myLink.port, bridge.dest, keyText)
+ keyText = bridge.key or bridge.src
+ print "%s %s:%d %s %10s %s" % (self.local.name(), myLink.host, myLink.port, bridge.dest, keyText,
+ bridge.srcIsLocal)
def clearAllRoutes(self):
links = self.qmf.getObjects(_class="link")
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org