mirror of https://github.com/apache/activemq.git
fixed some issues with measuring durable topic subscriber performance
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@390376 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f732943141
commit
a38a90657b
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2005-2006 The Apache Software Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.activemq.perf;
|
||||
|
||||
import javax.jms.ConnectionFactory;
|
||||
import javax.jms.DeliveryMode;
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.JMSException;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.broker.BrokerService;
|
||||
import org.apache.activemq.xbean.BrokerFactoryBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
/**
|
||||
* @version $Revision: 1.3 $
|
||||
*/
|
||||
public class KahaDurableTopicTest extends SimpleDurableTopicTest {
|
||||
|
||||
protected BrokerService createBroker() throws Exception{
|
||||
Resource resource=new ClassPathResource( "org/apache/activemq/perf/kahaBroker.xml");
|
||||
BrokerFactoryBean factory=new BrokerFactoryBean(resource);
|
||||
factory.afterPropertiesSet();
|
||||
BrokerService result=factory.getBroker();
|
||||
result.start();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -34,6 +34,7 @@ public class PerfConsumer implements MessageListener{
|
|||
protected PerfRate rate=new PerfRate();
|
||||
public PerfConsumer(ConnectionFactory fac,Destination dest,String consumerName) throws JMSException{
|
||||
connection=fac.createConnection();
|
||||
connection.setClientID(consumerName);
|
||||
Session s=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
|
||||
if(dest instanceof Topic&&consumerName!=null&&consumerName.length()>0){
|
||||
consumer=s.createDurableSubscriber((Topic) dest,consumerName);
|
||||
|
|
|
@ -36,9 +36,4 @@ public class SimpleDurableTopicTest extends SimpleTopicTest{
|
|||
return new PerfConsumer(fac,dest,"subs:"+number);
|
||||
}
|
||||
|
||||
protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
|
||||
ActiveMQConnectionFactory cf = super.createConnectionFactory();
|
||||
cf.setClientID(getName());
|
||||
return cf;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright 2005-2006 The Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<beans xmlns="http://activemq.org/config/1.0">
|
||||
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
|
||||
|
||||
<broker brokerName="broker" persistent="true" useShutdownHook="false">
|
||||
<transportConnectors>
|
||||
<transportConnector uri="tcp://localhost:61616"/>
|
||||
</transportConnectors>
|
||||
<persistenceAdapter>
|
||||
<kahaPersistentAdaptor dir = "activemq-data"/>
|
||||
</persistenceAdapter>
|
||||
</broker>
|
||||
|
||||
</beans>
|
||||
|
Loading…
Reference in New Issue