mirror of https://github.com/apache/activemq.git
AMQ-6183 Add isDispatchSync to the subscription view and deprecate the
meaningless one in the producer view
This commit is contained in:
parent
bc960f3a7e
commit
c2ad0c3251
|
@ -124,16 +124,15 @@ public class ProducerView implements ProducerViewMBean {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public boolean isDispatchAsync() {
|
public boolean isDispatchAsync() {
|
||||||
if (info != null) {
|
|
||||||
return info.isDispatchAsync();
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return pretty print
|
* @return pretty print
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ProducerView: " + getClientId() + ":" + getConnectionId();
|
return "ProducerView: " + getClientId() + ":" + getConnectionId();
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,8 +73,10 @@ public interface ProducerViewMBean {
|
||||||
int getProducerWindowSize();
|
int getProducerWindowSize();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @deprecated This value is no longer used for producers.
|
||||||
* @return if the Producer is configured for Async dispatch
|
* @return if the Producer is configured for Async dispatch
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@MBeanInfo("Is the producer configured for Async Dispatch")
|
@MBeanInfo("Is the producer configured for Async Dispatch")
|
||||||
boolean isDispatchAsync();
|
boolean isDispatchAsync();
|
||||||
|
|
||||||
|
|
|
@ -266,6 +266,15 @@ public class SubscriptionView implements SubscriptionViewMBean {
|
||||||
return info != null ? info.isNoLocal() : false;
|
return info != null ? info.isNoLocal() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return whether or not the subscriber is configured for async dispatch
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isDispatchAsync() {
|
||||||
|
ConsumerInfo info = getConsumerInfo();
|
||||||
|
return info != null ? info.isDispatchAsync() : false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the maximum number of pending messages allowed in addition to the
|
* @return the maximum number of pending messages allowed in addition to the
|
||||||
* prefetch size. If enabled to a non-zero value then this will
|
* prefetch size. If enabled to a non-zero value then this will
|
||||||
|
|
|
@ -160,6 +160,12 @@ public interface SubscriptionViewMBean {
|
||||||
@MBeanInfo("The subscription ignores local messages.")
|
@MBeanInfo("The subscription ignores local messages.")
|
||||||
boolean isNoLocal();
|
boolean isNoLocal();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return if the Consumer is configured for Async dispatch
|
||||||
|
*/
|
||||||
|
@MBeanInfo("Is the consumer configured for Async Dispatch")
|
||||||
|
boolean isDispatchAsync();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the maximum number of pending messages allowed in addition to the
|
* @return the maximum number of pending messages allowed in addition to the
|
||||||
* prefetch size. If enabled to a non-zero value then this will
|
* prefetch size. If enabled to a non-zero value then this will
|
||||||
|
|
|
@ -1790,4 +1790,51 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
|
||||||
assertEquals(1, subscriberView.getDequeueCounter());
|
assertEquals(1, subscriberView.getDequeueCounter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testSubscriptionViewProperties() throws Exception {
|
||||||
|
connection = createConnection();
|
||||||
|
connection.start();
|
||||||
|
|
||||||
|
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||||
|
|
||||||
|
Topic topic1 = session.createTopic("test.topic1?consumer.dispatchAsync=false&consumer.retroactive=true");
|
||||||
|
Topic topic2 = session.createTopic("test.topic2?consumer.dispatchAsync=true&consumer.retroactive=false&consumer.exclusive=true");
|
||||||
|
MessageConsumer consumer1 = session.createConsumer(topic1);
|
||||||
|
MessageConsumer consumer2 = session.createConsumer(topic2);
|
||||||
|
|
||||||
|
assertNotNull(consumer1);
|
||||||
|
assertNotNull(consumer2);
|
||||||
|
|
||||||
|
ObjectName topicObjName = assertRegisteredObjectName(
|
||||||
|
domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName=" + topic1.getTopicName());
|
||||||
|
final TopicViewMBean topic1View = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, topicObjName, TopicViewMBean.class, true);
|
||||||
|
ArrayList<SubscriptionViewMBean> subscriberViews = new ArrayList<SubscriptionViewMBean>();
|
||||||
|
for (ObjectName name : topic1View.getSubscriptions()) {
|
||||||
|
subscriberViews.add(MBeanServerInvocationHandler.newProxyInstance(mbeanServer, name, SubscriptionViewMBean.class, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
assertEquals(1, subscriberViews.size());
|
||||||
|
|
||||||
|
SubscriptionViewMBean subscription = subscriberViews.get(0);
|
||||||
|
|
||||||
|
assertFalse(subscription.isDispatchAsync());
|
||||||
|
assertTrue(subscription.isRetroactive());
|
||||||
|
assertFalse(subscription.isExclusive());
|
||||||
|
|
||||||
|
topicObjName = assertRegisteredObjectName(
|
||||||
|
domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName=" + topic2.getTopicName());
|
||||||
|
final TopicViewMBean topic2View = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, topicObjName, TopicViewMBean.class, true);
|
||||||
|
subscriberViews = new ArrayList<SubscriptionViewMBean>();
|
||||||
|
for (ObjectName name : topic2View.getSubscriptions()) {
|
||||||
|
subscriberViews.add(MBeanServerInvocationHandler.newProxyInstance(mbeanServer, name, SubscriptionViewMBean.class, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
assertEquals(1, subscriberViews.size());
|
||||||
|
|
||||||
|
subscription = subscriberViews.get(0);
|
||||||
|
|
||||||
|
assertTrue(subscription.isDispatchAsync());
|
||||||
|
assertFalse(subscription.isRetroactive());
|
||||||
|
assertTrue(subscription.isExclusive());
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue