Set the clientID of the connection for durable subscribers.

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@414502 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian T. Co 2006-06-15 08:13:18 +00:00
parent c2a51115cd
commit 6355225b13
1 changed files with 17 additions and 2 deletions

View File

@ -21,9 +21,16 @@ import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.jms.*;
import java.util.Properties;
import javax.jms.Connection;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.Topic;
public class JmsConsumerClient extends JmsPerformanceSupport {
private static final Log log = LogFactory.getLog(JmsConsumerClient.class);
@ -142,7 +149,15 @@ public class JmsConsumerClient extends JmsPerformanceSupport {
}
}
}
public Connection getConnection() throws JMSException {
Connection c = super.getConnection();
if (c.getClientID() == null && isDurable()) {
c.setClientID(getClientName());
}
return c;
}
public MessageConsumer createJmsConsumer() throws JMSException {
Destination[] dest = createDestination();
return createJmsConsumer(dest[0]);