activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From activeMqUser <manoranjan.si...@connectm.com>
Subject Re: Failover problem
Date Mon, 13 Sep 2010 12:47:31 GMT

Hi Dejan,

Thanks for your quick reply. Connection url i didnt get it properly, but i
am opening the JMS connection as following. 

public static Connection openJMSConnection()
	{
		isActiveMQRunning = false;
		ActiveMQConnectionFactory connectionFactory = null;
		Connection connection = null;
		int count = 0;
		// If unable to open the jmsConnection keep on trying untill success.
		while (!isActiveMQRunning)
		{
			try
			{
				log.info("Connecting to URL : " + MainClass.url + "\t" +
MainClass.userId + "\t" + MainClass.password);
				// Create a ActiveMQConnectionFactory object.
				connectionFactory = new ActiveMQConnectionFactory(MainClass.userId,
MainClass.password, MainClass.url);
				// Create a logicalAlarmConnection.
				connection = connectionFactory.createConnection();
				isActiveMQRunning = true;

			}
			catch (Exception e)
			{
				count++;
				InetAddress inet = null;
				if (count == 1)
				{
					try
					{
						inet = InetAddress.getLocalHost();
					}
					catch (Exception ex)
					{
						log.error("Error while getting ip address of System.. " + ex);
					}

					log.fatal("ActiveMQ Server is down... on " + inet + " machine");
				}
				else
				{
					log.error("Unable to open Connection. ActiveMQ Server is down... ");
				}
				isActiveMQRunning = false;
			}
		}
		return connection;
	}

If this is not enough to understand please let me know.

Thanks
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/Failover-problem-tp2537292p2537354.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message