You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ra...@apache.org on 2008/06/18 21:29:55 UTC
svn commit: r669263 - in /activemq/trunk/activemq-core/src:
main/java/org/apache/activemq/ main/java/org/apache/activemq/advisory/
main/java/org/apache/activemq/broker/jmx/
test/java/org/apache/activemq/usecases/
Author: rajdavies
Date: Wed Jun 18 12:29:54 2008
New Revision: 669263
URL: http://svn.apache.org/viewvc?rev=669263&view=rev
Log:
Apply patch from https://issues.apache.org/activemq/browse/AMQ-1808
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerEventSource.java
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionView.java
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionTestSupport.java
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java?rev=669263&r1=669262&r2=669263&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java Wed Jun 18 12:29:54 2008
@@ -1229,7 +1229,8 @@
try {
throw JMSExceptionSupport.create(er.getException());
}catch(Throwable e) {
- LOG.error("Caught an exception trying to create a JMSException",e);
+ System.err.println(er.getException());
+ LOG.error("Caught an exception trying to create a JMSException for " +er.getException(),e);
}
}
}
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java?rev=669263&r1=669262&r2=669263&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java Wed Jun 18 12:29:54 2008
@@ -261,14 +261,14 @@
/**
* @return Returns the value.
*/
- protected ConsumerId getConsumerId() {
+ public ConsumerId getConsumerId() {
return info.getConsumerId();
}
/**
* @return the consumer name - used for durable consumers
*/
- protected String getConsumerName() {
+ public String getConsumerName() {
return this.info.getSubscriptionName();
}
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerEventSource.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerEventSource.java?rev=669263&r1=669262&r2=669263&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerEventSource.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/advisory/ConsumerEventSource.java Wed Jun 18 12:29:54 2008
@@ -27,6 +27,7 @@
import javax.jms.MessageListener;
import javax.jms.Session;
+import org.apache.activemq.ActiveMQMessageConsumer;
import org.apache.activemq.Service;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQMessage;
@@ -52,7 +53,7 @@
private AtomicBoolean started = new AtomicBoolean(false);
private AtomicInteger consumerCount = new AtomicInteger();
private Session session;
- private MessageConsumer consumer;
+ private ActiveMQMessageConsumer consumer;
public ConsumerEventSource(Connection connection, Destination destination) throws JMSException {
this.connection = connection;
@@ -62,12 +63,16 @@
public void setConsumerListener(ConsumerListener listener) {
this.listener = listener;
}
+
+ public String getConsumerId() {
+ return consumer != null ? consumer.getConsumerId().toString() : "NOT_SET";
+ }
public void start() throws Exception {
if (started.compareAndSet(false, true)) {
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQTopic advisoryTopic = AdvisorySupport.getConsumerAdvisoryTopic(destination);
- consumer = session.createConsumer(advisoryTopic);
+ consumer = (ActiveMQMessageConsumer) session.createConsumer(advisoryTopic);
consumer.setMessageListener(this);
}
}
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionView.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionView.java?rev=669263&r1=669262&r2=669263&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionView.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionView.java Wed Jun 18 12:29:54 2008
@@ -44,7 +44,9 @@
super(clientId, sub);
this.broker = broker;
this.durableSub=(DurableTopicSubscription) sub;
- this.subscriptionName = sub.getConsumerInfo().getSubscriptionName();
+ if (sub != null) {
+ this.subscriptionName = sub.getConsumerInfo().getSubscriptionName();
+ }
}
/**
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionTestSupport.java?rev=669263&r1=669262&r2=669263&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionTestSupport.java Wed Jun 18 12:29:54 2008
@@ -111,7 +111,7 @@
protected abstract PersistenceAdapter createPersistenceAdapter() throws Exception;
- public void xtestUnsubscribeSubscription() throws Exception {
+ public void testUnsubscribeSubscription() throws Exception {
session = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
Topic topic = session.createTopic("TestTopic");
consumer = session.createDurableSubscriber(topic, "sub1");
@@ -144,7 +144,7 @@
assertTextMessageEquals("Msg:3", consumer.receive(5000));
}
- public void xtestInactiveDurableSubscriptionTwoConnections() throws Exception {
+ public void testInactiveDurableSubscriptionTwoConnections() throws Exception {
session = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
Topic topic = session.createTopic("TestTopic");
consumer = session.createDurableSubscriber(topic, "sub1");
@@ -175,7 +175,7 @@
assertTextMessageEquals("Msg:2", consumer.receive(5000));
}
- public void xtestInactiveDurableSubscriptionBrokerRestart() throws Exception {
+ public void testInactiveDurableSubscriptionBrokerRestart() throws Exception {
session = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
Topic topic = session.createTopic("TestTopic");
consumer = session.createDurableSubscriber(topic, "sub1");
@@ -266,7 +266,7 @@
assertTextMessageEquals("Msg:2", consumer.receive(5000));
}
- public void xtestSelectorChange() throws Exception {
+ public void testSelectorChange() throws Exception {
session = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
Topic topic = session.createTopic("TestTopic");
consumer = session.createDurableSubscriber(topic, "sub1", "color='red'", false);
@@ -301,7 +301,7 @@
assertTextMessageEquals("Msg:4", consumer.receive(5000));
}
- public void xtestDurableSubWorksInNewSession() throws JMSException {
+ public void testDurableSubWorksInNewSession() throws JMSException {
// Create the consumer.
connection.start();
@@ -328,7 +328,7 @@
}
- public void xtestDurableSubWorksInNewConnection() throws Exception {
+ public void testDurableSubWorksInNewConnection() throws Exception {
// Create the consumer.
connection.start();