[rhmessaging-commits] rhmessaging commits: r1148 - in mgmt: notes and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Oct 23 14:31:45 EDT 2007


Author: justi9
Date: 2007-10-23 14:31:45 -0400 (Tue, 23 Oct 2007)
New Revision: 1148

Modified:
   mgmt/cumin/python/cumin/demo.py
   mgmt/cumin/python/cumin/exchange.py
   mgmt/cumin/python/cumin/exchange.strings
   mgmt/cumin/python/cumin/model.py
   mgmt/cumin/python/cumin/queue.strings
   mgmt/notes/Todo
Log:
Adds producers.



Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py	2007-10-23 18:04:51 UTC (rev 1147)
+++ mgmt/cumin/python/cumin/demo.py	2007-10-23 18:31:45 UTC (rev 1148)
@@ -139,6 +139,11 @@
             exchange.name = name
             vhost.add_exchange(exchange)
 
+            for producer_count in range(10):
+                producer = Producer(self.model)
+                producer.name = fmt("producer", producer_count)
+                exchange.add_producer(producer)
+
         for queue_count in range(10):
             queue = Queue(self.model)
             queue.name = fmt("queue", queue_count)
@@ -200,6 +205,14 @@
                                     self.frob_measure(measure)
                             finally:
                                 binding.unlock()
+
+                        for producer in exchange.producer_items():
+                            producer.lock()
+                            try:
+                                for measure in producer.measurements:
+                                    self.frob_measure(measure)
+                            finally:
+                                producer.unlock()
                     
                     for queue in vhost.queue_items():
                         queue.lock()

Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py	2007-10-23 18:04:51 UTC (rev 1147)
+++ mgmt/cumin/python/cumin/exchange.py	2007-10-23 18:31:45 UTC (rev 1148)
@@ -87,9 +87,9 @@
         self.tabs = TabSet(app, "tabs")
         self.add_child(self.tabs)
 
+        self.tabs.add_tab(ProducerSet(app, "producers"))
         self.tabs.add_tab(ExchangeBindingSet(app, "bindings"))
         self.tabs.add_tab(ExchangeStatistics(app, "stats"))
-        self.tabs.add_tab(self.ExchangeProducers(app, "producers"))
 
     def render_title(self, session, exchange):
         return "Exchange '%s'" % exchange.name
@@ -275,3 +275,19 @@
     class StatisticsHistory(Widget):
         def render_title(self, session, exchange):
             return "History"
+
+class ProducerSet(ItemSet):
+    def render_title(self, session, queue):
+        return "Producers (%i)" % len(queue.producer_items())
+
+    def get_items(self, session, queue):
+        return sorted_by(queue.producer_items())
+
+    def render_item_name(self, session, producer):
+        return producer.name
+
+    def render_item_messages_produced(self, session, producer):
+        return producer.get_measurement("msgsProduced").get_value()
+
+    def render_item_bytes_produced(self, session, producer):
+        return producer.get_measurement("bytesProduced").get_value()

Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings	2007-10-23 18:04:51 UTC (rev 1147)
+++ mgmt/cumin/python/cumin/exchange.strings	2007-10-23 18:31:45 UTC (rev 1148)
@@ -132,3 +132,32 @@
     </td>
   </tr>
 </table>
+
+[ProducerSet.html]
+<select>
+  <option>Act on Selection...</option>
+  <option>Throttle Producers</option>
+  <option>Start Producers</option>
+  <option>Stop Producers</option>
+</select>
+
+<br/><br/>
+
+<table class="mobjects">
+  <tr>
+    <th><input type="checkbox"/></th>
+    <th>Producer</th>
+    <th style="text-align: right;">Msgs. Produced</th>
+    <th style="text-align: right;">Bytes Produced</th>
+  </tr>
+
+  {items}
+</table>
+
+[ProducerSet.item_html]
+<tr>
+  <td><input type="checkbox"/></td>
+  <td>{item_name}</td>
+  <td style="text-align: right;">{item_messages_produced}</td>
+  <td style="text-align: right;">{item_bytes_produced}</td>
+</tr>

Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py	2007-10-23 18:04:51 UTC (rev 1147)
+++ mgmt/cumin/python/cumin/model.py	2007-10-23 18:31:45 UTC (rev 1148)
@@ -16,6 +16,7 @@
         self.queue = ModelClass(self, "queue")
         self.consumer = ModelClass(self, "consumer")
         self.exchange = ModelClass(self, "exchange")
+        self.producer = ModelClass(self, "producer")
         self.client = ModelClass(self, "client")
         self.session = ModelClass(self, "session")
         self.realm = ModelClass(self, "realm")
@@ -78,6 +79,10 @@
         assoc.add_endpoint(self.virtual_host, "exchange", "0..n")
         assoc.add_endpoint(self.exchange, "virtual_host", "0..1")
 
+        assoc = ModelAssociation(self, "exchange_to_producers")
+        assoc.add_endpoint(self.exchange, "producer", "0..n")
+        assoc.add_endpoint(self.producer, "exchange", "0..1")
+
         assoc = ModelAssociation(self, "virtual_host_to_clients")
         assoc.add_endpoint(self.virtual_host, "client", "0..n")
         assoc.add_endpoint(self.client, "virtual_host", "0..1")
@@ -635,6 +640,22 @@
             
         writer.write("</exchange>")
 
+class Producer(MeasuredModelObject):
+    def __init__(self, model):
+        super(Producer, self).__init__(model, model.producer)
+
+        self.name = None
+
+        measure = Measurement("msgsProduced", "int")
+        measure.title = "Messages produced"
+        measure.categories = ("message", "general")
+        self.measurements.append(measure)
+        
+        measure = Measurement("bytesProduced", "int")
+        measure.title = "Bytes produced"
+        measure.categories = ("byte", "general")
+        self.measurements.append(measure)
+
 class Binding(ModelObject):
     def __init__(self, model):
         super(Binding, self).__init__(model, model.binding)

Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings	2007-10-23 18:04:51 UTC (rev 1147)
+++ mgmt/cumin/python/cumin/queue.strings	2007-10-23 18:31:45 UTC (rev 1148)
@@ -211,8 +211,8 @@
 <select>
   <option>Act on Selection...</option>
   <option>Throttle Consumers</option>
+  <option>Start Consumers</option>
   <option>Stop Consumers</option>
-  <option>Start Consumers</option>
   <option>Close Consumers</option>
 </select>
 
@@ -224,7 +224,7 @@
     <th>Consumer</th>
     <th style="text-align: right;">Msgs. Consumed</th>
     <th style="text-align: right;">Bytes Consumed</th>
-    <th style="text-align: right;">Msgs. Unacknowledged</th>
+    <th style="text-align: right;">Msgs. Unacked</th>
   </tr>
 
   {items}

Modified: mgmt/notes/Todo
===================================================================
--- mgmt/notes/Todo	2007-10-23 18:04:51 UTC (rev 1147)
+++ mgmt/notes/Todo	2007-10-23 18:31:45 UTC (rev 1148)
@@ -112,3 +112,7 @@
  * Rename routing_key to binding_key
 
  * Remove legacy show_view methods now that we have set_view_mode
+
+ * Make the model objects use MeasuredModelObject
+
+ * Add more bindings to the demo data




More information about the rhmessaging-commits mailing list