ActiveMQ Admin or commandline-jmx to configure memoryLimit at run time

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ActiveMQ Admin or commandline-jmx to configure memoryLimit at run time

mrdiesel
Hello,

I m trying to configure memory limit at run time to be able to throttle my producers.

Using jconsole and jmx I m able to change MemoryLimit (which is highlighted in blue) and throttle the producers.

But i want to be able to do this at run time, without having to restart the server.

I tried using commandline-jmxclient-0.10.3 which is the only version of it i could find online :( very old. and no luck.

I tried using activemq-admin and not sure how to get around that to set a value. I m aware that changes wont persist to config file.

How can i do it?

this is how i can query with commandline tool

java -jar cmdline-jmxclient-0.10.3.jar - localhost:1099
org.apache.activemq:BrokerName=defaultBroker,Destination=Testing,Type=Queue
EnqueueCount
11/18/2011 10:33:08 -0800 org.archive.jmx.Client EnqueueCount: 999

but i want to be able to set the MemoryLimit.

can someone advise please?

Thanks.

Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ Admin or commandline-jmx to configure memoryLimit at run time

Eugene
I might be wrong, but just trying.
How about if you start your own broker instance through

BrokerService broker = new BrokerService();
broker.setBrokerName("fast");
broker.getSystemUsage().getMemoryUsage().setLimit(64*1024*1024);
PolicyEntry policy = new PolicyEntry();
policy.setMemoryLimit(4 * 1024 *1024); // 4 * 1024 *1024 -> replace with a variable
policy.setProducerFlowControl(false);
PolicyMap pMap = new PolicyMap();
pMap.setDefaultEntry(policy);
broker.setDestinationPolicy(pMap);
broker.addConnector("tcp://localhost:61616");
broker.start();

and expose the variable with JMX.

Using Spring and MBeanServer should be pretty easy - not sure if it will work. :)

Cheers,
Eugene.