-
1. how to obtain a JMSServerControl?
rhinmass May 3, 2011 9:24 AM (in response to mingfai)MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
ObjectName on = ObjectNameBuilder.DEFAULT.getJMSServerObjectName();
MBeanInfo mbi = mBeanServer.getMBeanInfo(on);
System.out.println(mbi.getClassName());
MBeanAttributeInfo[] mbas = mbi.getAttributes();
for (MBeanAttributeInfo mba : mbas)
{
System.out.println("attr: " + mba.getName() + " of type " + mba.getType());
}
MBeanOperationInfo[] mbos = mbi.getOperations();
for (MBeanOperationInfo mbo : mbos)
{
System.out.println("oper: " + mbo.getName() );
MBeanParameterInfo[] mbps = mbo.getSignature();
for (MBeanParameterInfo mbp : mbps)
{
System.out.println(" param: " + mbp.getName());
}
System.out.println(" returns: " + mbo.getReturnType());
}
//get attributes on the JMSServerControl
String[] qnames = (String[]) mBeanServer.getAttribute(on, "QueueNames");
//invoke methods on the JMSServerControl
mBeanServer.invoke(on, "createQueue" ...)
-
2. how to obtain a JMSServerControl?
mingfai May 3, 2011 11:18 AM (in response to rhinmass)thx Robin. it's a bit too complex to use JMX given that my embedded usage allows me to access the objects directly.
I found a more "civilized" way to use JMSServerControl. EmbeddedJMS has a protected JMSServerManagerImpl member variable and I've extended it to expose the JMSServerManager to obtain the JMSServerManager for creating the JMSServerControl. Previously, I created a different JMSServerManagerImpl so the things won't work.
public class HornetQJMSServer extends EmbeddedJMS{
public JMSServerManagerImpl getJMSServerManager(){
return this.serverManager;
}
}
mingfai
-
3. how to obtain a JMSServerControl?
clebert.suconic May 3, 2011 2:24 PM (in response to mingfai)If you are Embedded, sure... it's simpler to just use the POJO.
The proxy is for a remote case.
-
4. Re: how to obtain a JMSServerControl?
senthivel Aug 16, 2013 6:05 AM (in response to mingfai)Hallo Robin,
i did as you suggested
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
ObjectName on = ObjectNameBuilder.DEFAULT.getJMSServerObjectName();
MBeanInfo mbi = mBeanServer.getMBeanInfo(on);
i get a error
javax.management.InstanceNotFoundException: org.hornetq:module=JMS,type=Server
Can you please suggest me,what i might be missing.
However i can see that in the management console that the testQueue is started. I am running EAP6.1 and HornetQ is a standard messaging .