modifying perf example to accept amqp connections as well
This commit is contained in:
parent
dc3b01036d
commit
0354944e8f
|
@ -57,6 +57,12 @@ under the License.
|
||||||
<artifactId>artemis-cli</artifactId>
|
<artifactId>artemis-cli</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.qpid</groupId>
|
||||||
|
<artifactId>qpid-jms-client</artifactId>
|
||||||
|
<version>0.5.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
|
|
|
@ -27,11 +27,11 @@ under the License.
|
||||||
<body onload="prettyPrint()">
|
<body onload="prettyPrint()">
|
||||||
<h1>JMS Simple Performance</h1>
|
<h1>JMS Simple Performance</h1>
|
||||||
|
|
||||||
<p>To start the server run <code>mvn verify -Pexample</code></p>
|
<p>To start the server run <code>mvn verify -Pserver</code></p>
|
||||||
|
|
||||||
<p>To start the listener run <code>mvn -Plistener package</code></p>
|
<p>To start the listener run <code>mvn -Plistener verify</code></p>
|
||||||
|
|
||||||
<p>To start the sender run <code>mvn -Psender package</code></p>
|
<p>To start the sender run <code>mvn -Psender verify</code></p>
|
||||||
|
|
||||||
<p>To configure the clients simply edit the <code>perf.properties</code> or <code>client.jndi.properties</code> in the
|
<p>To configure the clients simply edit the <code>perf.properties</code> or <code>client.jndi.properties</code> in the
|
||||||
<code>src/main/resources</code> directory</p>
|
<code>src/main/resources</code> directory</p>
|
||||||
|
|
|
@ -37,6 +37,7 @@ import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.apache.activemq.artemis.utils.TokenBucketLimiter;
|
import org.apache.activemq.artemis.utils.TokenBucketLimiter;
|
||||||
import org.apache.activemq.artemis.utils.TokenBucketLimiterImpl;
|
import org.apache.activemq.artemis.utils.TokenBucketLimiterImpl;
|
||||||
|
import org.apache.qpid.jms.JmsConnectionFactory;
|
||||||
|
|
||||||
public abstract class PerfBase {
|
public abstract class PerfBase {
|
||||||
|
|
||||||
|
@ -99,7 +100,7 @@ public abstract class PerfBase {
|
||||||
boolean dupsOK = Boolean.valueOf(props.getProperty("dups-ok-acknowlege"));
|
boolean dupsOK = Boolean.valueOf(props.getProperty("dups-ok-acknowlege"));
|
||||||
boolean disableMessageID = Boolean.valueOf(props.getProperty("disable-message-id"));
|
boolean disableMessageID = Boolean.valueOf(props.getProperty("disable-message-id"));
|
||||||
boolean disableTimestamp = Boolean.valueOf(props.getProperty("disable-message-timestamp"));
|
boolean disableTimestamp = Boolean.valueOf(props.getProperty("disable-message-timestamp"));
|
||||||
boolean openwire = Boolean.valueOf(props.getProperty("openwire", "true"));
|
String clientLibrary = props.getProperty("client-library", "core");
|
||||||
String uri = props.getProperty("server-uri", "tcp://localhost:61616");
|
String uri = props.getProperty("server-uri", "tcp://localhost:61616");
|
||||||
|
|
||||||
PerfBase.log.info("num-messages: " + noOfMessages);
|
PerfBase.log.info("num-messages: " + noOfMessages);
|
||||||
|
@ -115,7 +116,7 @@ public abstract class PerfBase {
|
||||||
PerfBase.log.info("disable-message-timestamp: " + disableTimestamp);
|
PerfBase.log.info("disable-message-timestamp: " + disableTimestamp);
|
||||||
PerfBase.log.info("dups-ok-acknowledge: " + dupsOK);
|
PerfBase.log.info("dups-ok-acknowledge: " + dupsOK);
|
||||||
PerfBase.log.info("server-uri: " + uri);
|
PerfBase.log.info("server-uri: " + uri);
|
||||||
PerfBase.log.info("openwire:" + openwire);
|
PerfBase.log.info("client-library:" + clientLibrary);
|
||||||
|
|
||||||
PerfParams perfParams = new PerfParams();
|
PerfParams perfParams = new PerfParams();
|
||||||
perfParams.setNoOfMessagesToSend(noOfMessages);
|
perfParams.setNoOfMessagesToSend(noOfMessages);
|
||||||
|
@ -130,7 +131,7 @@ public abstract class PerfBase {
|
||||||
perfParams.setDisableMessageID(disableMessageID);
|
perfParams.setDisableMessageID(disableMessageID);
|
||||||
perfParams.setDisableTimestamp(disableTimestamp);
|
perfParams.setDisableTimestamp(disableTimestamp);
|
||||||
perfParams.setDupsOK(dupsOK);
|
perfParams.setDupsOK(dupsOK);
|
||||||
perfParams.setOpenwire(openwire);
|
perfParams.setLibraryType(clientLibrary);
|
||||||
perfParams.setUri(uri);
|
perfParams.setUri(uri);
|
||||||
|
|
||||||
return perfParams;
|
return perfParams;
|
||||||
|
@ -160,7 +161,7 @@ public abstract class PerfBase {
|
||||||
|
|
||||||
connection = factory.createConnection();
|
connection = factory.createConnection();
|
||||||
}
|
}
|
||||||
else {
|
else if (perfParams.isCore()) {
|
||||||
factory = new org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory(perfParams.getUri());
|
factory = new org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory(perfParams.getUri());
|
||||||
|
|
||||||
destination = new org.apache.activemq.artemis.jms.client.ActiveMQQueue(perfParams.getDestinationName());
|
destination = new org.apache.activemq.artemis.jms.client.ActiveMQQueue(perfParams.getDestinationName());
|
||||||
|
@ -168,6 +169,19 @@ public abstract class PerfBase {
|
||||||
connection = factory.createConnection();
|
connection = factory.createConnection();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (perfParams.isAMQP()) {
|
||||||
|
factory = new JmsConnectionFactory(perfParams.getUri());
|
||||||
|
|
||||||
|
destination = new org.apache.activemq.artemis.jms.client.ActiveMQQueue(perfParams.getDestinationName());
|
||||||
|
|
||||||
|
connection = factory.createConnection();
|
||||||
|
|
||||||
|
Session sessionX = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||||
|
|
||||||
|
destination = sessionX.createQueue(perfParams.getDestinationName());
|
||||||
|
|
||||||
|
sessionX.close();
|
||||||
|
}
|
||||||
|
|
||||||
session = connection.createSession(perfParams.isSessionTransacted(), perfParams.isDupsOK() ? Session.DUPS_OK_ACKNOWLEDGE : Session.AUTO_ACKNOWLEDGE);
|
session = connection.createSession(perfParams.isSessionTransacted(), perfParams.isDupsOK() ? Session.DUPS_OK_ACKNOWLEDGE : Session.AUTO_ACKNOWLEDGE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,12 @@ public class PerfParams implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4336539641012356002L;
|
private static final long serialVersionUID = -4336539641012356002L;
|
||||||
|
|
||||||
|
enum ClientLibraryType {
|
||||||
|
core, openwire, amqp
|
||||||
|
}
|
||||||
|
|
||||||
|
private ClientLibraryType libraryType;
|
||||||
|
|
||||||
private int noOfMessagesToSend = 1000;
|
private int noOfMessagesToSend = 1000;
|
||||||
|
|
||||||
private int noOfWarmupMessages;
|
private int noOfWarmupMessages;
|
||||||
|
@ -47,8 +53,6 @@ public class PerfParams implements Serializable {
|
||||||
|
|
||||||
private boolean disableTimestamp;
|
private boolean disableTimestamp;
|
||||||
|
|
||||||
private boolean openwire;
|
|
||||||
|
|
||||||
private boolean dupsOK;
|
private boolean dupsOK;
|
||||||
|
|
||||||
private String uri;
|
private String uri;
|
||||||
|
@ -158,10 +162,28 @@ public class PerfParams implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOpenwire() {
|
public boolean isOpenwire() {
|
||||||
return openwire;
|
return libraryType.equals(ClientLibraryType.openwire);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOpenwire(boolean openwire) {
|
public boolean isAMQP() {
|
||||||
this.openwire = openwire;
|
return libraryType.equals(ClientLibraryType.amqp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCore() {
|
||||||
|
return libraryType.equals(ClientLibraryType.core);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientLibraryType getLibraryType() {
|
||||||
|
return libraryType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLibraryType(ClientLibraryType libraryType) {
|
||||||
|
this.libraryType = libraryType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setLibraryType(String libraryType) {
|
||||||
|
this.libraryType = ClientLibraryType.valueOf(libraryType);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,17 +15,23 @@
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
num-messages=25000
|
num-messages=250000
|
||||||
num-warmup-messages=1000
|
num-warmup-messages=1000
|
||||||
message-size=1024
|
message-size=1024
|
||||||
durable=true
|
durable=true
|
||||||
transacted=false
|
transacted=false
|
||||||
batch-size=1000
|
batch-size=100
|
||||||
drain-queue=false
|
drain-queue=true
|
||||||
destination-name=perfQueue
|
destination-name=jms.queue.perfQueue
|
||||||
throttle-rate=-1
|
throttle-rate=-1
|
||||||
dups-ok-acknowledge=false
|
dups-ok-acknowledge=false
|
||||||
disable-message-id=true
|
disable-message-id=true
|
||||||
disable-message-timestamp=true
|
disable-message-timestamp=true
|
||||||
server-uri=tcp://localhost:61616
|
|
||||||
openwire=false
|
server-uri=amqp://localhost:61616
|
||||||
|
#server-uri=tcp://localhost:61616
|
||||||
|
|
||||||
|
#valid ones are openwire,core,amqp
|
||||||
|
client-library=amqp
|
||||||
|
#client-library=openwire
|
||||||
|
#client-library=core
|
||||||
|
|
Loading…
Reference in New Issue