Skip to content

Commit

Permalink
Added support for the Artemis broker, updated ActiveMQ client library…
Browse files Browse the repository at this point in the history
… to the latest version
  • Loading branch information
AntonRoskvist committed Jan 8, 2020
1 parent 71314ef commit 6ddc3f3
Show file tree
Hide file tree
Showing 28 changed files with 530 additions and 41 deletions.
6 changes: 3 additions & 3 deletions AmqJmsCommon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>name.wramner.jmstools</groupId>
<artifactId>JmsTools</artifactId>
<version>1.10-SNAPSHOT</version>
<version>1.11-SNAPSHOT</version>
</parent>
<groupId>name.wramner.jmstools</groupId>
<artifactId>AmqJmsCommon</artifactId>
<version>1.10-SNAPSHOT</version>
<version>1.11-SNAPSHOT</version>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
Expand All @@ -25,7 +25,7 @@
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-client</artifactId>
<version>5.15.9</version>
<version>5.15.11</version>
</dependency>
<dependency>
<groupId>name.wramner.jmstools</groupId>
Expand Down
4 changes: 2 additions & 2 deletions AmqJmsConsumer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>name.wramner.jmstools</groupId>
<artifactId>JmsTools</artifactId>
<version>1.10-SNAPSHOT</version>
<version>1.11-SNAPSHOT</version>
</parent>
<groupId>name.wramner.jmstools</groupId>
<artifactId>AmqJmsConsumer</artifactId>
<version>1.10-SNAPSHOT</version>
<version>1.11-SNAPSHOT</version>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
Expand Down
4 changes: 2 additions & 2 deletions AmqJmsProducer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>name.wramner.jmstools</groupId>
<artifactId>JmsTools</artifactId>
<version>1.10-SNAPSHOT</version>
<version>1.11-SNAPSHOT</version>
</parent>
<groupId>name.wramner.jmstools</groupId>
<artifactId>AmqJmsProducer</artifactId>
<version>1.10-SNAPSHOT</version>
<version>1.11-SNAPSHOT</version>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
Expand Down
4 changes: 2 additions & 2 deletions AqJmsCommon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>name.wramner.jmstools</groupId>
<artifactId>JmsTools</artifactId>
<version>1.10-SNAPSHOT</version>
<version>1.11-SNAPSHOT</version>
</parent>
<groupId>name.wramner.jmstools</groupId>
<artifactId>AqJmsCommon</artifactId>
<version>1.10-SNAPSHOT</version>
<version>1.11-SNAPSHOT</version>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
Expand Down
4 changes: 2 additions & 2 deletions AqJmsConsumer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>name.wramner.jmstools</groupId>
<artifactId>JmsTools</artifactId>
<version>1.10-SNAPSHOT</version>
<version>1.11-SNAPSHOT</version>
</parent>
<groupId>name.wramner.jmstools</groupId>
<artifactId>AqJmsConsumer</artifactId>
<version>1.10-SNAPSHOT</version>
<version>1.11-SNAPSHOT</version>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
Expand Down
4 changes: 2 additions & 2 deletions AqJmsProducer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>name.wramner.jmstools</groupId>
<artifactId>JmsTools</artifactId>
<version>1.10-SNAPSHOT</version>
<version>1.11-SNAPSHOT</version>
</parent>
<groupId>name.wramner.jmstools</groupId>
<artifactId>AqJmsProducer</artifactId>
<version>1.10-SNAPSHOT</version>
<version>1.11-SNAPSHOT</version>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
Expand Down
44 changes: 44 additions & 0 deletions ArtemisJmsCommon/pom.xml
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>

89 changes: 89 additions & 0 deletions ArtemisJmsConsumer/pom.xml
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>

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);
}
}
}
}
31 changes: 31 additions & 0 deletions ArtemisJmsConsumer/src/main/resources/logback.xml
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>
Loading

0 comments on commit 6ddc3f3

Please sign in to comment.