activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jigar Naik <>
Subject Producer stops producing messages after producing 1542 messages.
Date Sat, 30 Aug 2008 09:15:00 GMT


i am facing problem with producer, 

My producer stops producing messages after producing 1542 messages on active

bellow is my output after running producer thread 

Message Sent : Hello This is a text message on active MQ : 1542
Exception in thread "ActiveMQ Transport: tcp://localhost/"
java.lang.OutOfMemoryError: Java heap space
Exception in thread "InactivityMonitor ReadCheck"
java.lang.OutOfMemoryError: Java heap space

What could be the possible reason for this error..

bellow is my producer code...
package org.icrm;

import javax.jms.Connection;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;

import org.apache.activemq.ActiveMQConnectionFactory;

public class Producer {
	private MessageProducer 	producer;
	ActiveMQConnectionFactory 	connectionFactory;
	Connection 					connection;
	Session 					session;
	Destination 				destination;
	public static void main(String[] args) {
		Producer p = new Producer();
		for(int i=0;i<100000;i++){
			p.sendMessageToActiveMQ("Hello This is a text message on active MQ : " +
i, "TestQueue");
	 * Send Message to ActiveMQ
	 * @param message
	 * @param queueName
	public void sendMessageToActiveMQ(String message,String queueName){
		try {
			connectionFactory 	= new
			connection 			= connectionFactory.createConnection();
			session 			= connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
			destination 		= session.createQueue(queueName);
			this.producer 		= session.createProducer(destination);
			TextMessage textMessage = session.createTextMessage();
			System.out.println("Message Sent : " + message);
		} catch (JMSException e) {
		} catch (Exception e){
			producer 			= null;
			connectionFactory 	= null;
			connection 			= null;
			session 			= null;
			destination 		        = null;


View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message