activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From archa <>
Subject Unable to write to a queue in a master-slave configuration
Date Fri, 17 Feb 2012 05:30:44 GMT
In my configuration in which I am using the failover protocol to get a
master-slave configuration. <broker1> and <broker2> are configured to point
to the same database.

Following is my code snippet to create queue sender to send the messages on
the queue.
	Properties props = new Properties();

	props.setProperty("queue.queue1", "wdp.queue1");

	Context ctx = new InitialContext(props);
	QueueConnectionFactory qFactory = (QueueConnectionFactory)

	QueueConnection conn = qFactory.createQueueConnection();

	//Creating a queue session
	final QueueSession session = conn.createQueueSession(false,

	Queue queue = (Queue) ctx.lookup(queueName);

	//Creating a queue sender to send the message on the queue
	QueueSender sender = session.createSender(queue);
	//Invoking QueueSender.send
If I have only the broker started, the application can successfully send the
message on the queue on which the broker is active. 
Whereas if both broker1 and broker2 are started, where one broker has the
lock on the database and other is looping for the lock, the application
waits indefinately for the event to be sent by sender.send().

Am I missing some configuration in the failover protocol or need some
special setting on the brokers?

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

View raw message