mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-4426 - queuesender and topicpublisher need to delegate destination tracking, otherwise anonymous publishers return null destination
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1463789 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2aed3a708c
commit
059fd2f8c4
|
@ -45,7 +45,7 @@ public class PooledQueueSender extends PooledProducer implements QueueSender {
|
|||
|
||||
@Override
|
||||
public Queue getQueue() throws JMSException {
|
||||
return getQueueSender().getQueue();
|
||||
return (Queue) getDestination();
|
||||
}
|
||||
|
||||
protected ActiveMQQueueSender getQueueSender() {
|
||||
|
|
|
@ -149,7 +149,7 @@ public class PooledSession implements Session, TopicSession, QueueSession, XASes
|
|||
try {
|
||||
sessionPool.invalidateObject(key, this);
|
||||
} catch (Exception e) {
|
||||
throw JMSExceptionSupport.create(e);
|
||||
LOG.trace("Ignoring exception on invalidateObject as discarding session: " + e, e);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
|
|
|
@ -35,7 +35,7 @@ public class PooledTopicPublisher extends PooledProducer implements TopicPublish
|
|||
|
||||
@Override
|
||||
public Topic getTopic() throws JMSException {
|
||||
return getTopicPublisher().getTopic();
|
||||
return (Topic) getDestination();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,7 +18,11 @@ package org.apache.activemq.pool;
|
|||
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import javax.jms.BytesMessage;
|
||||
import javax.jms.QueueConnection;
|
||||
import javax.jms.QueueConnectionFactory;
|
||||
import javax.jms.QueueSender;
|
||||
import javax.jms.QueueSession;
|
||||
import javax.jms.Session;
|
||||
import javax.jms.TopicConnection;
|
||||
import javax.jms.TopicConnectionFactory;
|
||||
|
@ -167,4 +171,23 @@ public class XAConnectionPoolTest extends TestSupport {
|
|||
assertFalse(pcf.isTmFromJndi());
|
||||
}
|
||||
|
||||
public void testSenderAndPublisherDest() throws Exception {
|
||||
XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
|
||||
pcf.setConnectionFactory(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false"));
|
||||
|
||||
QueueConnection connection = pcf.createQueueConnection();
|
||||
QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
QueueSender sender = session.createSender(session.createQueue("AA"));
|
||||
assertNotNull(sender.getQueue().getQueueName());
|
||||
|
||||
connection.close();
|
||||
|
||||
TopicConnection topicConnection = pcf.createTopicConnection();
|
||||
TopicSession topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
TopicPublisher topicPublisher = topicSession.createPublisher(topicSession.createTopic("AA"));
|
||||
assertNotNull(topicPublisher.getTopic().getTopicName());
|
||||
|
||||
topicConnection.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue