From c17f41dac7a30ed85df281ea2218c1d7fb0f14f9 Mon Sep 17 00:00:00 2001 From: jbertram Date: Mon, 11 Apr 2016 14:20:19 -0500 Subject: [PATCH] ARTEMIS-476 example fixes/docs --- README.md | 11 ++---- examples/README.md | 39 ------------------- .../src/main/resources/spring-jms-beans.xml | 2 +- .../jms/example/XAHeuristicExample.java | 3 +- .../spring/SpringJmsBootstrap.java | 4 ++ 5 files changed, 11 insertions(+), 48 deletions(-) delete mode 100644 examples/README.md diff --git a/README.md b/README.md index d8109a01d4..b770fb5e79 100644 --- a/README.md +++ b/README.md @@ -29,16 +29,13 @@ To run an example firstly make sure you have run If the project version has already been released then this is unnecessary. -then you will need to set the following maven options, on Linux by - - $ export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=512m" - -and the finally run the examples by +Each individual example can be run using this command from its corresponding directory: $ mvn verify -You can also run individual examples by running the same command from the directory of which ever example you want to run. -NB for this make sure you have installed examples/common. +If you wish to run groups of examples then use this command from a parent directory (e.g. examples/features/standard): + + $ mvn -Pexamples verify ### Recreating the examples diff --git a/examples/README.md b/examples/README.md deleted file mode 100644 index 3d0fdd9131..0000000000 --- a/examples/README.md +++ /dev/null @@ -1,39 +0,0 @@ -Running the ActiveMQ Artemis Examples -============================ - -To run an individual example firstly cd into the example directory and run - -```sh -mvn verify -``` - -Most examples offer a way to start them without creating and starting the server (say if you want to do it manually) - -```sh -mvn verify -PnoServer -``` - -If you are running against an un released version, i.e. from master branch, you will have to run `mvn install` on the root -pom.xml and the example/activemq-jms-examples-common/pom.xml first. - -If you want to run all the examples (except those that need to be run standalone) you can run `mvn verify -Pexamples` in the examples -directory but before you do you will need to up the memory used by running: - -``` -export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m" -``` - -if you are running a Mac OS, you may want to add this to run the clustered examples: - -``` -export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true" -``` - -### Recreating the examples - -If you are trying to copy the examples somewhere else and modifying them. Consider asking Maven to explicitly list all the dependencies: - -``` -# if trying to modify the 'topic' example: -cd examples/jms/topic && mvn dependency:list -``` diff --git a/examples/features/standard/spring-integration/src/main/resources/spring-jms-beans.xml b/examples/features/standard/spring-integration/src/main/resources/spring-jms-beans.xml index 274a8faef9..7db39ea9bc 100644 --- a/examples/features/standard/spring-integration/src/main/resources/spring-jms-beans.xml +++ b/examples/features/standard/spring-integration/src/main/resources/spring-jms-beans.xml @@ -48,7 +48,7 @@ under the License. + destroy-method="close"> diff --git a/examples/features/standard/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java b/examples/features/standard/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java index 1299f8e943..6025b322f6 100644 --- a/examples/features/standard/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java +++ b/examples/features/standard/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java @@ -39,6 +39,7 @@ import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.HashMap; +import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; import org.apache.activemq.artemis.utils.UUIDGenerator; @@ -140,7 +141,7 @@ public class XAHeuristicExample { MBeanServerConnection mbsc = connector.getMBeanServerConnection(); // Step 27. List the prepared transactions - ObjectName serverObject = ObjectNameBuilder.DEFAULT.getActiveMQServerObjectName(); + ObjectName serverObject = ObjectNameBuilder.create(ActiveMQDefaultConfiguration.getDefaultJmxDomain(), "0.0.0.0", true).getActiveMQServerObjectName(); String[] infos = (String[]) mbsc.invoke(serverObject, "listPreparedTransactions", null, null); System.out.println("Prepared transactions: "); diff --git a/integration/activemq-spring-integration/src/main/java/org/apache/activemq/artemis/integration/spring/SpringJmsBootstrap.java b/integration/activemq-spring-integration/src/main/java/org/apache/activemq/artemis/integration/spring/SpringJmsBootstrap.java index ff4518141f..3bbfc3dcde 100644 --- a/integration/activemq-spring-integration/src/main/java/org/apache/activemq/artemis/integration/spring/SpringJmsBootstrap.java +++ b/integration/activemq-spring-integration/src/main/java/org/apache/activemq/artemis/integration/spring/SpringJmsBootstrap.java @@ -28,4 +28,8 @@ public class SpringJmsBootstrap extends EmbeddedJMS implements BeanFactoryAware public void setBeanFactory(BeanFactory beanFactory) throws BeansException { registry = new SpringBindingRegistry((ConfigurableBeanFactory) beanFactory); } + + public void close() throws Exception { + stop(); + } }