activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joesan <>
Subject Re: ActiveMQ Clustering Issue
Date Thu, 23 Aug 2012 06:45:18 GMT
Below is how my Consumer looks like:

*public class Consumer {

    private static String brokerURL =
    private static transient ConnectionFactory factory;
    private transient Connection connection;
    private transient Session session;
    //private String clientId = "Client1";
    //private static String consumerName = "Consumer1";
    protected static Destination destination;
    public Consumer() throws JMSException {
    	factory = new ActiveMQConnectionFactory(brokerURL);
    	connection = factory.createConnection();
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        destination = session.createTopic("MYTOPIC.CLUSTERTOPIC"); 
    public void close() throws JMSException {
        if (connection != null) {
    public static void main(String[] args) throws JMSException {
    	try {
        	Consumer consumer = new Consumer();
        	MessageConsumer messageConsumer =
        	//messageConsumer =
        	messageConsumer.setMessageListener(new Listener());
    	} catch (Exception ex) {
	public Session getSession() {
		return session;


As soon as I have the Master shutdown, my Consumer dies out. I have a
durable Producer and as per my understanding the messages in the topic
should be preserved untill a Consumer is available. Am I right? But I'm
surprised to see that some of my messages that the Producer had sent to the
Topic got lost during the Consumer down time. Any idea as to what I'm doing
wrong here with my Consumer?

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

View raw message