activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agujral <anurag_guj...@yahoo.com>
Subject Trying to access activemq statistics not working
Date Fri, 06 May 2011 22:13:56 GMT
Hi All,
          I have enabled statistics plugin in activeMq and then I am running
a java code pasted below
but I dont seem to be getting any statistics data please help:

When I run the below code it hangs waiting for the response:
May 6, 2011 5:11:33 PM org.apache.activemq.broker.BrokerService start
INFO: Using Persistence Adapter:
AMQPersistenceAdapter(activemq-data/localhost)
May 6, 2011 5:11:34 PM org.apache.activemq.store.amq.AMQPersistenceAdapter
start
INFO: AMQStore starting using directory: activemq-data/localhost
May 6, 2011 5:11:34 PM org.apache.activemq.kaha.impl.KahaStore initialize
INFO: Kaha Store using data directory activemq-data/localhost/kr-store/state
May 6, 2011 5:11:34 PM org.apache.activemq.store.amq.AMQPersistenceAdapter
start
INFO: Active data files: [1]
May 6, 2011 5:11:34 PM org.apache.activemq.broker.BrokerService getBroker
INFO: ActiveMQ null JMS Message Broker (localhost) is starting
May 6, 2011 5:11:34 PM org.apache.activemq.broker.BrokerService getBroker
INFO: For help or more information please see: http://activemq.apache.org/
May 6, 2011 5:11:34 PM org.apache.activemq.kaha.impl.KahaStore initialize
INFO: Kaha Store using data directory activemq-data/localhost/kr-store/data
May 6, 2011 5:11:34 PM org.apache.activemq.broker.BrokerService start
INFO: ActiveMQ JMS Message Broker (localhost,
ID:mq02.res.bluekai.com-30625-1304719894086-0:0) started
May 6, 2011 5:11:34 PM org.apache.activemq.broker.TransportConnector start
INFO: Connector vm://localhost Started
May 6, 2011 5:11:34 PM org.apache.activemq.broker.jmx.ManagementContext$1
run
INFO: JMX consoles can connect to
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
Here is the java code I am using:
package com.bluekai.SDT.BrokerStats;
import javax.jms.Connection;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.ActiveMQMessageConsumer;
import java.util.Enumeration;
public class BrokerStats {

public static void main(String[] argv) throws Exception  {

  printBrokerStats();

}

private static void printBrokerStats() throws JMSException {
 ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("vm://localhost");

  //ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("tcp://mq02.res.bluekai.com?broker.persistent=false&broker.useJmx=false");
  Connection connection;
  connection = connectionFactory.createConnection();
  connection.start();
 Session  session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);


 Destination replyTo = session.createTemporaryQueue();
MessageConsumer consumer = session.createConsumer(replyTo);

String queueName = "ActiveMQ.Statistics.Broker";
Destination testQueue = session.createQueue(queueName);
MessageProducer producer = session.createProducer(testQueue);
Message msg = session.createMessage();

msg.setJMSReplyTo(replyTo);
producer.send(msg);


MapMessage reply = (MapMessage) consumer.receive();

for (Enumeration e = reply.getMapNames();e.hasMoreElements();) {
  String name = e.nextElement().toString();
  System.out.println(name + "=" + reply.getObject(name));
 }
 connection.close();
 }
}




--
View this message in context: http://activemq.2283324.n4.nabble.com/Trying-to-access-activemq-statistics-not-working-tp3504459p3504459.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message