I've created a branch with a prototype code for JBM 2 Management API:
It follows the management API specified in http://wiki.jboss.org/wiki/JBM2Management
The code is not complete but there is already enough to get a feel on how JBM2 will be managed.
The steps are:
* svn co https://svn.jboss.org/repos/messaging/branches/Branch_JBMESSAGING-1303
* ant runServer
* in another shell, start jconsole and connect to the "Local" JVM.
* go to the "MBeans" tab
* all JBM2 resources are under "org.jboss.messaging"
some of the things to show how JBM2 will be managed:
* for "JMS > Server" MBean, go to the "Operations" tab and create a JMS Queue "foo" (if you hover on the "createQueue" button or the "name" & "jndiBinding" labels, you will have tooltips appear to describe the operation and its parameters)
-> the Queue will appear in "JMS > Queue"
-> an Address and a Queue will also be manageable in "Core > Address" and "Core > Queue"
* go to "JMS > Queue > MyQueue" and double-click on "MessageCount" value
* run "ant perfListener" & "ant perfSender"
-> the messageCount will be be displayed as a chart to show the size of the queue as messages are produced/consumed
* run "ant durSubExample"
* go to "JMS > Topic > testTopic" and click on the "Operations" tab
* invoke "listDurablesSubscribers" to have a dialog with info about the durable subscriber
* go to "Core > Queue > topicjms.testTopic > myclientid.myuniqueid" to see the Core queue associated to the durable subscriber
About the code
All the management API are in:
* o.j.m.core.management for the Core resources
* o.j.m.jms.server.management for the JMS resources
implementations are in the impl subpackages
MBeans are registered/unregistered as their managed resources are created/destroyed. This is done through the ManagementRegistration (resp. JMSManagementRegistration) interface for the Core (resp. JMS) resources which are injected in the code (e.g. PostOffice.setManagementRegistration() & StorageManager.setManagementRegistration())
Code can be completely unit tested using mock (see MessagingControlTest for an example) since the MBean implementations are only thin wrappers on the resources (+ user validation & open type conversion)
Some of the things I need to prototype:
* Notifications (e.g. when a queue is created/destroyed) will be centralized on the Core server & JMS server MBeans
* I'm not convinced that exposing an Address is correct or not. The only important information on the Address MBean is the roles associated to the Address. Adding/removing a role only makes sense for an address, not for a queue. A possibility is to get rid of the Address MBean, move the add/remove role to the Core Server MBean (with an adress parameter) and moved roleInfos to the Queue MBeans (I prefer to have them as attributes than operation on the Server MBean for usability sake)
I plan to continue committing in this branch and once the team agreed on the API and implementation, I'll merge it into the trunk
Any comments/critics/feedback is welcomed