Made qdstat backward compatible with version 1.3 and 1.4
@@ -343,11 +343,7 @@ class BusManager(Node):
heads.append(Header("addr"))
heads.append(Header("phs"))
heads.append(Header("cap"))
- heads.append(Header("pri"))
- heads.append(Header("undel"))
- heads.append(Header("unsett"))
- heads.append(Header("del"))
- heads.append(Header("presett"))
+
rows = []
cols = ('linkType', 'linkDir', 'connectionId', 'identity', 'peer', 'owningAddr',
@@ -358,12 +354,23 @@ class BusManager(Node):
objects = self.query('org.apache.qpid.dispatch.router.link', cols, limit=self.opts.limit)
has_dropped_presettled_count = False
+ has_priority = False
if objects:
first_row = objects[0]
if first_row:
if hasattr(first_row, 'droppedPresettledCount'):
has_dropped_presettled_count = True
+ if hasattr(first_row, 'priority'):
+ has_priority = True
+
+ if has_priority:
+ heads.append(Header("pri"))
+ heads.append(Header("undel"))
+ heads.append(Header("unsett"))
+ heads.append(Header("del"))
+ heads.append(Header("presett"))
+
if has_dropped_presettled_count:
heads.append(Header("psdrop"))
@@ -388,6 +395,7 @@ class BusManager(Node):
row.append(self._addr_text(link.owningAddr))
row.append(self._addr_phase(link.owningAddr))
row.append(link.capacity)
+ if has_priority:
row.append(link.priority)
row.append(link.undeliveredCount)
row.append(link.unsettledCount)
@@ -463,6 +471,23 @@ class BusManager(Node):
heads.append(Header("addr"))
heads.append(Header("phs"))
heads.append(Header("distrib"))
+
+ rows = []
+ cols = ('distribution', 'inProcess', 'subscriberCount', 'remoteCount',
+ 'containerCount', 'deliveriesIngress', 'deliveriesEgress',
+ 'deliveriesTransit', 'deliveriesToContainer', 'deliveriesFromContainer', 'name', 'priority')
+
+ objects = self.query('org.apache.qpid.dispatch.router.address', cols, limit=self.opts.limit)
+
+ has_priority = False
+
+ if objects:
+ first_row = objects[0]
+ if first_row:
+ if hasattr(first_row, 'priority'):
+ has_priority = True
+
+ if has_priority:
heads.append(Header("pri"))
heads.append(Header("in-proc", Header.COMMAS))
heads.append(Header("local", Header.COMMAS))
@@ -473,12 +498,6 @@ class BusManager(Node):
heads.append(Header("thru", Header.COMMAS))
heads.append(Header("to-proc", Header.COMMAS))
heads.append(Header("from-proc", Header.COMMAS))
- rows = []
- cols = ('distribution', 'inProcess', 'subscriberCount', 'remoteCount',
- 'containerCount', 'deliveriesIngress', 'deliveriesEgress',
- 'deliveriesTransit', 'deliveriesToContainer', 'deliveriesFromContainer', 'name', 'priority')
-
- objects = self.query('org.apache.qpid.dispatch.router.address', cols, limit=self.opts.limit)
for addr in objects:
row = []
@@ -486,6 +505,7 @@ class BusManager(Node):
row.append(self._addr_text(addr.name))
row.append(self._addr_phase(addr.name))
row.append(addr.distribution)
+ if has_priority:
row.append(addr.priority if addr.priority >= 0 else "")
row.append(addr.inProcess)
row.append(addr.subscriberCount)
