I am trying to implement performance testing on ActiveMQ, so have setup a basic producer and consumer to send and receive messages across a queue. I have created a producer with no problems, getting it to write a specific number of messages to the queue:
for(int i = 0; i < numberOfMessages; i++){
try{
String message = generateText(sizeOfMessage);
produceMessage(message);
}
catch (Exception e) {
logger.error("Caught exception while sending message", e);
}
}
This continues to completion with no problems and I have confirmed this with checks on the admin website, that have the correct number of messages pending.
The problem occurs when I try to receive the messages from the queue. Using a simple consumer to read from the queue, it will read a various number of messages from the queue, but then will stop when trying to receive one of the messages. I can see that there are still messages in the queue to be read, but the client will not progress passed one of the messages. I am using a simple method to receive the messages:
Message message = jmsTemplate.receive();
and it works for some messages(about 20-30) but then just locks. It was suggested to me that some of the characters in the message may be an escape character (I was using a random string of varying length, due to this just being a performance test, not actually sending over any content) so I changed all messages to the same string, which is a repetition of the char '2' and still no luck. I am using Spring configuration to load all of the components needed to access the ActiveMQ queue, and the queue is running on my localhost.