Is it possible to dynamically add and register new attributes to mbean
eg :
<server>
<mbean code="org.jboss.example.MyMbean" name="jboss:service=myMbean,name=MyMbeanExample">
<attribute name="attribute1">value1</attribute>
<attribute name="attribute2">value2</attribute>
<attribute name="attribute3">value3</attribute>
<attribute name="attribute4">value5</attribute>
<attribute name="attribute5">value5</attribute>...
</mbean>
</server>
A new attribute added in jboss-service.xml should be registered in MyMbean dynamically with making any code change in Mbean, can this be done?
Thanks in Advance.
It's hard to answer your question without seeing the code of your DynamicMBean, but I suspect the answer to your question, with the proviso that there be no code changes in the MBean, is no. However, here's an overall approach (taking some liberal assumptions about your code):
Since you're using JBoss, if you feel you might want to implement something like this, consider extending JBoss's ServiceDynamicMBeanSupport. It does some, but not all, of the legwork for you.