forked from erik-wramner/JmsTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for the Artemis broker, updated ActiveMQ client library…
… to the latest version
- Loading branch information
1 parent
71314ef
commit 6ddc3f3
Showing
28 changed files
with
530 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?xml version="1.0"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>name.wramner.jmstools</groupId> | ||
<artifactId>JmsTools</artifactId> | ||
<version>1.11-SNAPSHOT</version> | ||
</parent> | ||
<groupId>name.wramner.jmstools</groupId> | ||
<artifactId>ArtemisJmsCommon</artifactId> | ||
<version>1.11-SNAPSHOT</version> | ||
<licenses> | ||
<license> | ||
<name>The Apache Software License, Version 2.0</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
<distribution>repo</distribution> | ||
<comments>A business-friendly OSS license</comments> | ||
</license> | ||
</licenses> | ||
<properties> | ||
<project.build.sourceEncoding>Cp1252</project.build.sourceEncoding> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.activemq</groupId> | ||
<artifactId>artemis-jms-client</artifactId> | ||
<version>2.10.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>name.wramner.jmstools</groupId> | ||
<artifactId>JmsCommon</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<description>JMS Artemis common code.</description> | ||
</project> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?xml version="1.0"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>name.wramner.jmstools</groupId> | ||
<artifactId>JmsTools</artifactId> | ||
<version>1.11-SNAPSHOT</version> | ||
</parent> | ||
<groupId>name.wramner.jmstools</groupId> | ||
<artifactId>ArtemisJmsConsumer</artifactId> | ||
<version>1.11-SNAPSHOT</version> | ||
<licenses> | ||
<license> | ||
<name>The Apache Software License, Version 2.0</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
<distribution>repo</distribution> | ||
<comments>A business-friendly OSS license</comments> | ||
</license> | ||
</licenses> | ||
<properties> | ||
<project.build.sourceEncoding>Cp1252</project.build.sourceEncoding> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>name.wramner.jmstools</groupId> | ||
<artifactId>ArtemisJmsCommon</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>name.wramner.jmstools</groupId> | ||
<artifactId>JmsConsumer</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<description>JMS Artemis message consumer for performance tests.</description> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>3.0.0</version> | ||
<executions> | ||
<execution> | ||
<id>shade-application</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
<configuration> | ||
<minimizeJar>false</minimizeJar> | ||
<outputFile>../shaded-jars/ArtemisJmsConsumer.jar</outputFile> | ||
<filters> | ||
<filter> | ||
<artifact>*:*</artifact> | ||
<excludes> | ||
<exclude>META-INF/*.SF</exclude> | ||
<exclude>META-INF/*.DSA</exclude> | ||
<exclude>META-INF/*.RSA</exclude> | ||
</excludes> | ||
</filter> | ||
</filters> | ||
<transformers> | ||
<transformer | ||
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | ||
<manifestEntries> | ||
<Main-Class>name.wramner.jmstools.consumer.ArtemisJmsConsumer</Main-Class> | ||
<Specification-Title>${project.artifactId}</Specification-Title> | ||
<Specification-Version>${project.version}</Specification-Version> | ||
<Implementation-Title>${project.artifactId}</Implementation-Title> | ||
<Implementation-Version>${project.version}</Implementation-Version> | ||
<Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id> | ||
</manifestEntries> | ||
</transformer> | ||
</transformers> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> | ||
|
92 changes: 92 additions & 0 deletions
92
ArtemisJmsConsumer/src/main/java/name/wramner/jmstools/consumer/ArtemisJmsConsumer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* Copyright 2016 Erik Wramner. | ||
* | ||
* 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 name.wramner.jmstools.consumer; | ||
|
||
import javax.jms.ConnectionFactory; | ||
import javax.jms.JMSException; | ||
import javax.jms.XAConnectionFactory; | ||
|
||
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; | ||
import org.apache.activemq.artemis.jms.client.ActiveMQXAConnectionFactory; | ||
import org.kohsuke.args4j.Option; | ||
|
||
import name.wramner.jmstools.consumer.ArtemisJmsConsumer.ArtemisConsumerConfiguration; | ||
|
||
/** | ||
* Command line JMS Artemis message consumer intended for benchmarks and other tests. | ||
* | ||
* @author Erik Wramner | ||
* @author Anton Roskvist | ||
*/ | ||
public class ArtemisJmsConsumer extends JmsConsumer<ArtemisConsumerConfiguration> { | ||
|
||
/** | ||
* Program entry point. | ||
* | ||
* @param args Command line. | ||
* @see ArtemisConsumerConfiguration | ||
*/ | ||
public static void main(String[] args) { | ||
new ArtemisJmsConsumer().run(args); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
protected ArtemisConsumerConfiguration createConfiguration() { | ||
return new ArtemisConsumerConfiguration(); | ||
} | ||
|
||
/** | ||
* Artemis consumer configuration. It extends the basic JMS consumer configuration with Artemis-specific settings | ||
* such as broker URL, user and password needed in order to connect to the Artemis broker. | ||
* | ||
* @author Erik Wramner | ||
* @author Anton Roskvist | ||
*/ | ||
public static class ArtemisConsumerConfiguration extends JmsConsumerConfiguration { | ||
@Option(name = "-url", aliases = { "--jms-broker-url" }, usage = "Artemis broker URL", required = true) | ||
private String _brokerUrl; | ||
|
||
@Option(name = "-user", aliases = { "--jms-user", | ||
"--jms-broker-user" }, usage = "Artemis user name if using authentication") | ||
private String _userName; | ||
|
||
@Option(name = "-pw", aliases = { "--jms-password", | ||
"--jms-broker-password" }, usage = "Artemis password if using authentication", depends = { | ||
"-user" }) | ||
private String _password; | ||
|
||
@Override | ||
public ConnectionFactory createConnectionFactory() throws JMSException { | ||
if (_userName != null && _password != null) { | ||
return new ActiveMQConnectionFactory(_brokerUrl, _userName, _password); | ||
} else { | ||
return new ActiveMQConnectionFactory(_brokerUrl); | ||
} | ||
} | ||
|
||
@Override | ||
public XAConnectionFactory createXAConnectionFactory() throws JMSException { | ||
if (_userName != null && _password != null) { | ||
return new ActiveMQXAConnectionFactory(_brokerUrl, _userName, _password); | ||
} else { | ||
return new ActiveMQXAConnectionFactory(_brokerUrl); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="ISO-8859-1"?> | ||
<configuration> | ||
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<pattern>%d %t %-5p %c %m%n</pattern> | ||
</encoder> | ||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | ||
<level>INFO</level> | ||
</filter> | ||
</appender> | ||
<appender name="debug_file" class="ch.qos.logback.core.FileAppender"> | ||
<File>debug.log</File> | ||
<encoder> | ||
<pattern>%d %t %-5p %c %m%n</pattern> | ||
</encoder> | ||
</appender> | ||
<appender name="stat_file" class="ch.qos.logback.core.FileAppender"> | ||
<File>stats.log</File> | ||
<encoder> | ||
<pattern>%d %m%n</pattern> | ||
</encoder> | ||
</appender> | ||
<logger name="statistics" additivity="false" level="info"> | ||
<appender-ref ref="stdout" /> | ||
<appender-ref ref="stat_file" /> | ||
</logger> | ||
<root level="info"> | ||
<appender-ref ref="stdout" /> | ||
<appender-ref ref="debug_file" /> | ||
</root> | ||
</configuration> |
Oops, something went wrong.