I have two programs, the first is a producer:
public class Producer {
public static void main(String[] args) throws Exception {
final ConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:12345");
final Connection c = cf.createConnection();
final Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);
final TextMessage msg = s.createTextMessage("rho " + new Date().toString());
final MessageProducer p = s.createProducer(new ActiveMQQueue("rmannibucau"));
p.send(msg);
p.close();
s.close();
c.close();
}
}
and the second is a consumer:
public class Listener {
public static void main(String[] args) throws Exception {
final ConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:12345");
final Connection c = cf.createConnection();
final Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);
s.createConsumer(s.createQueue("rmannibucau")).setMessageListener(new MessageListener() {
@Override
public void onMessage(Message message) {
System.out.println(message.toString());
}
});
c.start();
s.run();
}
}
I use ActiveMQ, java, jms and I want to test with Jmetter to know how much message consumer can consume in 1 minute, help me please.
You’re going to need to create some sort of Custom Java Sampler. When creating one of these, you can call your code from inside, set start/end timers, if the request was successful/failed etc. Then, you put this jar into JMeter and it will appear as a Java Sampler. From here, you can use all of JMeter’s functionality to specify users, requests, time limit, etc.
I hope this is enough of a start to help you out.