NO-JIRA fix-up examples

This commit is contained in:
Justin Bertram 2018-03-01 11:20:41 -06:00
parent b5f0225f29
commit afd7d8b30f
77 changed files with 268 additions and 175 deletions

View File

@ -30,13 +30,16 @@ export TEST_TARGET="./target"
cd $ARTEMIS_HOME/examples/features/standard/
cd bridge; mvn verify; cd ..
cd bridge; mvn verify; cd ..
cd browser; mvn verify; cd ..
cd auto-closeable; mvn verify; cd ..
cd broker-plugin; mvn verify; cd ..
cd browser; mvn verify; cd ..
cd cdi; mvn verify; cd ..
cd client-kickoff; mvn verify; cd ..
cd completion-listener; mvn verify; cd ..
cd consumer-rate-limit; mvn verify; cd ..
cd context; mvn verify; cd ..
cd core-bridge; mvn verify; cd ..
cd database; mvn verify; cd ..
cd dead-letter; mvn verify; cd ..
cd delayed-redelivery; mvn verify; cd ..
cd divert; mvn verify; cd ..
@ -45,16 +48,14 @@ cd embedded; mvn verify; cd ..
cd embedded-simple; mvn verify; cd ..
cd expiry; mvn verify; cd ..
cd http-transport; mvn verify; cd ..
cd interceptor; mvn verify; cd ..
cd interceptor-client; mvn verify; cd ..
cd interceptor-client-mqtt; mvn verify; cd ..
cd jms-auto-closeable; mvn verify; cd ..
cd instantiate-connection-factory; mvn verify; cd ..
cd interceptor; mvn verify; cd ..
cd interceptor-amqp; mvn verify; cd ..
cd interceptor-client; mvn verify; cd ..
cd interceptor-mqtt; mvn verify; cd ..
cd jms-bridge; mvn verify; cd ..
cd jms-completion-listener; mvn verify; cd ..
cd jms-context; mvn verify; cd ..
cd jms-shared-consumer; mvn verify; cd ..
cd jmx; mvn verify; cd ..
cd jmx-ssl; mvn verify; cd ..
# too big for most CI machines
#cd large-message; mvn verify; cd ..
@ -80,15 +81,18 @@ cd scheduled-message; mvn verify; cd ..
cd security; mvn verify; cd ..
cd security-ldap; mvn verify; cd ..
cd send-acknowledgements; mvn verify; cd ..
cd shared-consumer; mvn verify; cd ..
cd slow-consumer; mvn verify; cd ..
cd spring-integration; mvn verify; cd ..
cd ssl-enabled; mvn verify; cd ..
cd ssl-enabled-crl-mqtt; mvn verify; cd ..
cd ssl-enabled-dual-authentication; mvn verify; cd ..
cd static-selector; mvn verify; cd ..
cd temp-queue; mvn verify; cd ..
cd topic; mvn verify; cd ..
cd topic-hierarchies; mvn verify; cd ..
cd topic-selector-example1; mvn verify; cd ..
cd topic-selector-example2; mvn verify; cd ..
cd topic-selector1; mvn verify; cd ..
cd topic-selector2; mvn verify; cd ..
cd transactional; mvn verify; cd ..
cd xa-heuristic; mvn verify; cd ..
cd xa-receive; mvn verify; cd ..
@ -134,5 +138,37 @@ cd scale-down; mvn verify; cd ..
cd transaction-failover; mvn verify; cd ..
cd $ARTEMIS_HOME/examples/protocols/amqp/
cd queue; mvn verify; cd ..
cd $ARTEMIS_HOME/examples/protocols/mqtt/
cd clustered-queue-mqtt; mvn verify; cd ..
cd publish-subscribe; mvn verify; cd ..
cd $ARTEMIS_HOME/examples/protocols/openwire/
cd queue; mvn verify; cd ..
cd message-listener; mvn verify; cd ..
cd message-recovery; mvn verify; cd ..
cd $ARTEMIS_HOME/examples/protocols/stomp/
cd stomp; mvn verify; cd ..
cd stomp1.1; mvn verify; cd ..
cd stomp1.2; mvn verify; cd ..
cd stomp-dual-authentication; mvn verify; cd ..
cd stomp-embedded-interceptor; mvn verify; cd ..
cd stomp-jms; mvn verify; cd ..
cd $CURRENT_DIR
rm -rf target

View File

@ -30,12 +30,16 @@ export TEST_TARGET="./target"
cd $ARTEMIS_HOME/examples/features/standard/
cd bridge; mvn verify; cd ..
cd bridge; mvn verify; cd ..
cd browser; mvn verify; cd ..
cd auto-closeable; mvn verify; cd ..
cd broker-plugin; mvn verify; cd ..
cd browser; mvn verify; cd ..
cd cdi; mvn verify; cd ..
cd client-kickoff; mvn verify; cd ..
cd completion-listener; mvn verify; cd ..
cd consumer-rate-limit; mvn verify; cd ..
cd context; mvn verify; cd ..
cd core-bridge; mvn verify; cd ..
cd database; mvn verify; cd ..
cd dead-letter; mvn verify; cd ..
cd delayed-redelivery; mvn verify; cd ..
cd divert; mvn verify; cd ..
@ -44,15 +48,14 @@ cd embedded; mvn verify; cd ..
cd embedded-simple; mvn verify; cd ..
cd expiry; mvn verify; cd ..
cd http-transport; mvn verify; cd ..
cd interceptor; mvn verify; cd ..
cd interceptor-client; mvn verify; cd ..
cd jms-auto-closeable; mvn verify; cd ..
cd instantiate-connection-factory; mvn verify; cd ..
cd interceptor; mvn verify; cd ..
cd interceptor-amqp; mvn verify; cd ..
cd interceptor-client; mvn verify; cd ..
cd interceptor-mqtt; mvn verify; cd ..
cd jms-bridge; mvn verify; cd ..
cd jms-completion-listener; mvn verify; cd ..
cd jms-context; mvn verify; cd ..
cd jms-shared-consumer; mvn verify; cd ..
cd jmx; mvn verify; cd ..
cd jmx-ssl; mvn verify; cd ..
# too big for most CI machines
#cd large-message; mvn verify; cd ..
@ -78,15 +81,18 @@ cd scheduled-message; mvn verify; cd ..
cd security; mvn verify; cd ..
cd security-ldap; mvn verify; cd ..
cd send-acknowledgements; mvn verify; cd ..
cd shared-consumer; mvn verify; cd ..
cd slow-consumer; mvn verify; cd ..
cd spring-integration; mvn verify; cd ..
cd ssl-enabled; mvn verify; cd ..
cd ssl-enabled-crl-mqtt; mvn verify; cd ..
cd ssl-enabled-dual-authentication; mvn verify; cd ..
cd static-selector; mvn verify; cd ..
cd temp-queue; mvn verify; cd ..
cd topic; mvn verify; cd ..
cd topic-hierarchies; mvn verify; cd ..
cd topic-selector-example1; mvn verify; cd ..
cd topic-selector-example2; mvn verify; cd ..
cd topic-selector1; mvn verify; cd ..
cd topic-selector2; mvn verify; cd ..
cd transactional; mvn verify; cd ..
cd xa-heuristic; mvn verify; cd ..
cd xa-receive; mvn verify; cd ..

View File

@ -1,32 +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 broker (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"
```
### 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
```

View File

@ -27,7 +27,7 @@
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>artemis-cdi-example</artifactId>
<artifactId>cdi</artifactId>
<packaging>jar</packaging>
<name>ActiveMQ Artemis CDI Example</name>
@ -153,7 +153,7 @@
<dependencies>
<dependency>
<groupId>org.apache.activemq.examples.broker</groupId>
<artifactId>artemis-cdi-example</artifactId>
<artifactId>cdi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>

View File

@ -27,9 +27,9 @@ under the License.
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>datatabase</artifactId>
<artifactId>database</artifactId>
<packaging>jar</packaging>
<name>ActiveMQ Artemis JMS Expiry Example</name>
<name>ActiveMQ Artemis JMS Database Example</name>
<properties>
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
@ -104,7 +104,7 @@ under the License.
<dependencies>
<dependency>
<groupId>org.apache.activemq.examples.broker</groupId>
<artifactId>datatabase</artifactId>
<artifactId>database</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

View File

@ -4,4 +4,6 @@ To run the example, simply type **mvn verify** from this directory, or **mvn -Pn
This example shows you how to configure ActiveMQ Artemis to run with a database.
Notice this is not making any assumption of what is the recommended database to be used with Artemis. After all we recommend the artemis journal to be used, however in certain environments users will prefer databases for specific reasons.
### Notice
This is not making any assumption of what is the recommended database to be used with Artemis. We generally recommend the Artemis journal to be used. However, in certain environments users will prefer databases for specific reasons.

View File

@ -18,10 +18,7 @@ specific language governing permissions and limitations
under the License.
-->
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:activemq"
xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:activemq" xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
<core xmlns="urn:activemq:core">
<persistence-enabled>false</persistence-enabled>
@ -30,11 +27,9 @@ under the License.
<acceptor name="in-vm">vm://0</acceptor>
</acceptors>
<!-- Other config -->
<security-settings>
<!--security for example queue-->
<security-setting match="#">
<permission type="createAddress" roles="guest"/>
<permission type="createDurableQueue" roles="guest"/>
<permission type="deleteDurableQueue" roles="guest"/>
<permission type="createNonDurableQueue" roles="guest"/>
@ -43,6 +38,5 @@ under the License.
<permission type="send" roles="guest"/>
</security-setting>
</security-settings>
</core>
</configuration>

View File

@ -27,7 +27,7 @@ under the License.
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>bridge</artifactId>
<artifactId>jms-bridge</artifactId>
<packaging>jar</packaging>
<name>ActiveMQ Artemis JMS Bridge Example</name>
@ -147,7 +147,7 @@ under the License.
<dependencies>
<dependency>
<groupId>org.apache.activemq.examples.broker</groupId>
<artifactId>bridge</artifactId>
<artifactId>jms-bridge</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

View File

@ -14,6 +14,15 @@ To access this MBeanServer remotely, add the following to the management.xml con
With these properties, ActiveMQ Artemis broker will be manageable remotely using standard JMX URL on port `1099`.
The various keystore files are generated using the following commands:
* `keytool -genkey -keystore server-side-keystore.jks -storepass secureexample -keypass secureexample -dname "CN=ActiveMQ Artemis Server, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA`
* `keytool -export -keystore server-side-keystore.jks -file server-side-cert.cer -storepass secureexample`
* `keytool -import -keystore client-side-truststore.jks -file server-side-cert.cer -storepass secureexample -keypass secureexample -noprompt`
* `keytool -genkey -keystore client-side-keystore.jks -storepass secureexample -keypass secureexample -dname "CN=ActiveMQ Artemis Client, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA`
* `keytool -export -keystore client-side-keystore.jks -file client-side-cert.cer -storepass secureexample`
* `keytool -import -keystore server-side-truststore.jks -file client-side-cert.cer -storepass secureexample -keypass secureexample -noprompt`
## More information
* [Java management guide](https://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html)

View File

@ -83,10 +83,10 @@ public class JMXOverSSLExample {
String[] creds = {"guest", "guest"};
env.put(JMXConnector.CREDENTIALS, creds);
System.setProperty("javax.net.ssl.trustStore", args[0] + "activemq.example.truststore");
System.setProperty("javax.net.ssl.trustStorePassword", "activemqexample");
System.setProperty("javax.net.ssl.keyStore", args[0] + "activemq.example.keystore");
System.setProperty("javax.net.ssl.keyStorePassword", "activemqexample");
System.setProperty("javax.net.ssl.trustStore", args[0] + "client-side-truststore.jks");
System.setProperty("javax.net.ssl.trustStorePassword", "secureexample");
System.setProperty("javax.net.ssl.keyStore", args[0] + "client-side-keystore.jks");
System.setProperty("javax.net.ssl.keyStorePassword", "secureexample");
JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMXOverSSLExample.JMX_URL), env);
@ -131,6 +131,11 @@ public class JMXOverSSLExample {
if (connection != null) {
connection.close();
}
System.clearProperty("javax.net.ssl.trustStore");
System.clearProperty("javax.net.ssl.trustStorePassword");
System.clearProperty("javax.net.ssl.keyStore");
System.clearProperty("javax.net.ssl.keyStorePassword");
}
}
}

View File

@ -20,10 +20,10 @@
connector-port="1099"
connector-host="localhost"
secured="true"
key-store-path="${data.dir}/../etc/activemq.example.keystore"
key-store-password="activemqexample"
trust-store-path="${data.dir}/../etc/activemq.example.truststore"
trust-store-password="activemqexample"/>
key-store-path="${data.dir}/../etc/server-side-keystore.jks"
key-store-password="secureexample"
trust-store-path="${data.dir}/../etc/server-side-truststore.jks"
trust-store-password="secureexample"/>
<authorisation>
<whitelist>
<entry domain="hawtio"/>

View File

@ -41,12 +41,15 @@ under the License.
<profile>
<id>release</id>
<modules>
<module>bridge</module>
<module>auto-closeable</module>
<module>browser</module>
<module>broker-plugin</module>
<module>cdi</module>
<module>client-kickoff</module>
<module>completion-listener</module>
<module>consumer-rate-limit</module>
<module>context</module>
<module>core-bridge</module>
<module>database</module>
<module>dead-letter</module>
<module>delayed-redelivery</module>
@ -61,11 +64,7 @@ under the License.
<module>interceptor-mqtt</module>
<module>interceptor-amqp</module>
<module>instantiate-connection-factory</module>
<module>jms-auto-closeable</module>
<module>jms-bridge</module>
<module>jms-completion-listener</module>
<module>jms-context</module>
<module>jms-shared-consumer</module>
<module>jmx</module>
<module>jmx-ssl</module>
<module>large-message</module>
@ -90,32 +89,36 @@ under the License.
<module>security</module>
<module>security-ldap</module>
<module>send-acknowledgements</module>
<module>shared-consumer</module>
<module>slow-consumer</module>
<module>spring-integration</module>
<module>ssl-enabled</module>
<module>ssl-enabled-crl-mqtt</module>
<module>ssl-enabled-dual-authentication</module>
<module>static-selector</module>
<module>temp-queue</module>
<module>topic</module>
<module>topic-hierarchies</module>
<module>topic-selector-example1</module>
<module>topic-selector-example2</module>
<module>topic-selector1</module>
<module>topic-selector2</module>
<module>transactional</module>
<module>xa-heuristic</module>
<module>xa-receive</module>
<module>xa-send</module>
<module>ssl-enabled-crl-mqtt</module>
</modules>
</profile>
<profile>
<id>examples</id>
<modules>
<module>bridge</module>
<module>auto-closeable</module>
<module>browser</module>
<module>broker-plugin</module>
<module>cdi</module>
<module>client-kickoff</module>
<module>completion-listener</module>
<module>consumer-rate-limit</module>
<module>context</module>
<module>core-bridge</module>
<module>database</module>
<module>dead-letter</module>
<module>delayed-redelivery</module>
@ -129,12 +132,8 @@ under the License.
<module>interceptor-client</module>
<module>interceptor-mqtt</module>
<module>interceptor-amqp</module>
<module>jms-auto-closeable</module>
<module>instantiate-connection-factory</module>
<module>jms-bridge</module>
<module>jms-completion-listener</module>
<module>jms-context</module>
<module>jms-shared-consumer</module>
<module>jmx</module>
<module>jmx-ssl</module>
<module>large-message</module>
@ -153,16 +152,17 @@ under the License.
<module>queue-requestor</module>
<module>queue-selector</module>
<module>reattach-node</module>
<module>request-reply</module>
<module>rest</module>
<module>request-reply</module>
<module>scheduled-message</module>
<module>security</module>
<module>security-ldap</module>
<module>send-acknowledgements</module>
<module>shared-consumer</module>
<module>slow-consumer</module>
<module>spring-integration</module>
<module>ssl-enabled</module>
<module>ssl-enabled-crl-mqtt</module>
<module>ssl-enabled-dual-authentication</module>
<module>static-selector</module>
@ -172,13 +172,12 @@ under the License.
<module>temp-queue</module>
<module>topic</module>
<module>topic-hierarchies</module>
<module>topic-selector-example1</module>
<module>topic-selector-example2</module>
<module>topic-selector1</module>
<module>topic-selector2</module>
<module>transactional</module>
<module>xa-heuristic</module>
<module>xa-receive</module>
<module>xa-send</module>
<module>ssl-enabled-crl-mqtt</module>
</modules>
</profile>

View File

@ -18,6 +18,7 @@ specific language governing permissions and limitations
under the License.
-->
<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
<core xmlns="urn:activemq:core">
<bindings-directory>./data/messaging/bindings</bindings-directory>
<journal-directory>./data/messaging/journal</journal-directory>

View File

@ -37,6 +37,7 @@ under the License.
<security-settings>
<!--security for example queues -->
<security-setting match="#">
<permission roles="guest" type="deleteAddress"/>
<permission roles="guest" type="createDurableQueue"/>
<permission roles="guest" type="deleteDurableQueue"/>
<permission roles="guest" type="createNonDurableQueue"/>
@ -44,20 +45,6 @@ under the License.
<permission roles="guest" type="consume"/>
<permission roles="guest" type="send"/>
</security-setting>
<!-- security settings for JMS temporary queue -->
<security-setting match="#">
<permission roles="guest" type="createNonDurableQueue"/>
<permission roles="guest" type="deleteNonDurableQueue"/>
<permission roles="guest" type="consume"/>
<permission roles="guest" type="send"/>
</security-setting>
</security-settings>
<addresses>
<address name="exampleQueue">
<anycast>
<queue name="jms.queue.exampleQueue"/>
</anycast>
</address>
</addresses>
</core>
</configuration>

View File

@ -56,8 +56,9 @@ under the License.
<profile>
<id>examples</id>
<modules>
<!-- this one to be run manually
<module>proton-cpp</module> -->
<!-- these to be run manually
<module>proton-cpp</module>
<module>proton-clustered-cpp</module> -->
<module>queue</module>
<module>proton-ruby</module>

View File

@ -29,7 +29,7 @@ under the License.
<artifactId>clustered-queue-mqtt</artifactId>
<packaging>jar</packaging>
<name>ActiveMQ Artemis JMS Clustered Queue Example</name>
<name>ActiveMQ Artemis MQTT Clustered Queue Example</name>
<properties>
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
@ -117,7 +117,7 @@ under the License.
<goal>runClient</goal>
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.ClusteredQueueMQTTExample</clientClass>
<clientClass>org.apache.activemq.artemis.mqtt.example.ClusteredQueueMQTTExample</clientClass>
</configuration>
</execution>
<execution>
@ -149,7 +149,7 @@ under the License.
</executions>
<dependencies>
<dependency>
<groupId>org.apache.activemq.examples.clustered</groupId>
<groupId>org.apache.activemq.examples.mqtt</groupId>
<artifactId>clustered-queue-mqtt</artifactId>
<version>${project.version}</version>
</dependency>

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.artemis.jms.example;
package org.apache.activemq.artemis.mqtt.example;
import java.util.concurrent.TimeUnit;
import org.fusesource.mqtt.client.BlockingConnection;

View File

@ -40,15 +40,15 @@ under the License.
<profile>
<id>release</id>
<modules>
<module>basic-pubsub</module>
<module>clustered-queue-mqtt</module>
<module>publish-subscribe</module>
</modules>
</profile>
<profile>
<id>examples</id>
<modules>
<module>basic-pubsub</module>
<module>clustered-queue-mqtt</module>
<module>publish-subscribe</module>
</modules>
</profile>
</profiles>

View File

@ -27,9 +27,9 @@ under the License.
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>artemis-mqtt-publish-example</artifactId>
<artifactId>publish-subscribe</artifactId>
<packaging>jar</packaging>
<name>ActiveMQ Artemis MQTT Publish Example</name>
<name>ActiveMQ Artemis MQTT Publish/Subscribe Example</name>
<properties>
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
@ -60,6 +60,7 @@ under the License.
<goal>cli</goal>
</goals>
<configuration>
<ignore>${noServer}</ignore>
<spawn>true</spawn>
<testURI>tcp://localhost:61616</testURI>
<args>
@ -73,10 +74,7 @@ under the License.
<goal>runClient</goal>
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.mqtt.example.MQTTBasicPubSubExample</clientClass>
<args>
<param>${basedir}/target/server0</param>
</args>
<clientClass>org.apache.activemq.artemis.mqtt.example.MQTTPublishSubscribeExample</clientClass>
</configuration>
</execution>
<execution>
@ -85,6 +83,7 @@ under the License.
<goal>cli</goal>
</goals>
<configuration>
<ignore>${noServer}</ignore>
<args>
<param>stop</param>
</args>
@ -94,7 +93,7 @@ under the License.
<dependencies>
<dependency>
<groupId>org.apache.activemq.examples.mqtt</groupId>
<artifactId>artemis-mqtt-publish-example</artifactId>
<artifactId>publish-subscribe</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

View File

@ -1,4 +1,4 @@
# MQTT Example
# MQTT Publish/Subscribe Example
This is a basic MQTT example that demonstrates how to setup and connect to an Apache Artemis broker and send and receive messages using the MQTT protocol.

View File

@ -27,7 +27,7 @@ import org.fusesource.mqtt.client.Topic;
/**
* A simple MQTT publish and subscribe example.
*/
public class MQTTBasicPubSubExample {
public class MQTTPublishSubscribeExample {
public static void main(final String[] args) throws Exception {
// Create a new MQTT connection to the broker. We are not setting the client ID. The broker will pick one for us.

View File

@ -29,7 +29,7 @@ under the License.
<artifactId>message-listener</artifactId>
<packaging>jar</packaging>
<name>ActiveMQ Artemis JMS Queue Example for openwire</name>
<name>ActiveMQ Artemis OpenWire JMS Message Listener Example</name>
<properties>
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
@ -84,7 +84,7 @@ under the License.
<goal>runClient</goal>
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.QueueExample</clientClass>
<clientClass>org.apache.activemq.artemis.jms.example.MessageListenerExample</clientClass>
</configuration>
</execution>
<execution>

View File

@ -1,5 +1,5 @@
# JMS Queue Message Listener for OpenWire
# OpenWire JMS Message Listener Example
To run the example, simply type **mvn verify** from this directory, or **mvn -PnoServer verify** if you want to start and create the broker manually.
This example shows how to use a MessageListener with the OpenWire client
This example shows how to use a MessageListener with the OpenWire client.

View File

@ -30,10 +30,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.activemq.ActiveMQConnectionFactory;
/**
* A simple JMS Queue example that creates a producer and consumer on a queue and sends then receives a message.
*/
public class QueueExample {
public class MessageListenerExample {
public static void main(final String[] args) throws Exception {
Connection connection = null;

View File

@ -29,7 +29,7 @@ under the License.
<artifactId>message-recovery</artifactId>
<packaging>jar</packaging>
<name>ActiveMQ Artemis JMS Queue Example for openwire</name>
<name>ActiveMQ Artemis OpenWire JMS Message Recovery Example</name>
<properties>
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
@ -79,7 +79,7 @@ under the License.
<goal>runClient</goal>
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.QueueExample</clientClass>
<clientClass>org.apache.activemq.artemis.jms.example.MessageRecoveryExample</clientClass>
<args>
<param>${basedir}/target/server0</param>
</args>

View File

@ -1,5 +1,5 @@
# JMS Queue Message Listener for OpenWire
# OpenWire JMS Message Recovery Example
This example will start and stop the broker within the example.
This example shows how to use send messages to a queue, and having these messages recovered from the journal.
This example shows how to use send messages to a queue and having these messages recovered from the journal when the broker is restarted.

View File

@ -31,16 +31,13 @@ import java.util.concurrent.TimeUnit;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.util.ServerUtil;
/**
* A simple JMS Queue example that creates a producer and consumer on a queue and sends then receives a message.
*/
public class QueueExample {
public class MessageRecoveryExample {
public static void main(final String[] args) throws Exception {
Connection connection = null;
Process server0 = null;
try {
server0 = ServerUtil.startServer(args[0], QueueExample.class.getSimpleName() + "0", 0, 5000);
server0 = ServerUtil.startServer(args[0], MessageRecoveryExample.class.getSimpleName() + "0", 0, 5000);
ConnectionFactory cf = new ActiveMQConnectionFactory();
@ -66,7 +63,7 @@ public class QueueExample {
ServerUtil.killServer(server0);
server0 = ServerUtil.startServer(args[0], QueueExample.class.getSimpleName() + "0", 0, 5000);
server0 = ServerUtil.startServer(args[0], MessageRecoveryExample.class.getSimpleName() + "0", 0, 5000);
ServerUtil.waitForServerToStart(0, 5000);

View File

@ -29,7 +29,7 @@ under the License.
<artifactId>queue-openwire</artifactId>
<packaging>jar</packaging>
<name>ActiveMQ Artemis JMS Queue Example for openwire</name>
<name>ActiveMQ Artemis OpenWire JMS Queue Example</name>
<properties>
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>

View File

@ -1,13 +1,9 @@
# JMS Queue Example for OpenWire
# OpenWire JMS Queue Example
To run the example, simply type **mvn verify** from this directory, or **mvn -PnoServer verify** if you want to start and create the broker manually.
This example shows you how to send and receive a message to a JMS Queue using ActiveMQ Artemis.
This example shows you how to send and receive a message to a JMS queue using ActiveMQ Artemis.
This example does exactly the same as the "queue" example however using the OpenWire client.
Queues are a standard part of JMS, please consult the JMS 1.1 specification for full details.
A Queue is used to send messages point to point, from a producer to a consumer. The queue guarantees message ordering between these 2 points.
Notice this example is using pretty much a default stock configuration
Notice this example is using the default configuration.

View File

@ -80,13 +80,10 @@ under the License.
<goal>runClient</goal>
</goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.StompDualAuthenticationExample</clientClass>
<args>
<arg>${project.basedir}/target/server0/etc/client-side-keystore.jks</arg>
<arg>secureexample</arg>
<arg>${project.basedir}/target/server0/etc/client-side-truststore.jks</arg>
<arg>secureexample</arg>
</args>
<arg>${project.build.outputDirectory}/activemq/server0/</arg>
</args>
<clientClass>org.apache.activemq.artemis.jms.example.StompDualAuthenticationExample</clientClass>
</configuration>
</execution>
<execution>

View File

@ -42,17 +42,18 @@ public class StompDualAuthenticationExample {
private static final String END_OF_FRAME = "\u0000";
public static void main(final String[] args) throws Exception {
// set up SSL keystores for Stomp connection
System.setProperty("javax.net.ssl.keyStore", args[0]);
System.setProperty("javax.net.ssl.keyStorePassword", args[1]);
System.setProperty("javax.net.ssl.trustStore", args[2]);
System.setProperty("javax.net.ssl.trustStorePassword", args[3]);
Connection connection = null;
InitialContext initialContext = null;
Security.addProvider(new Provider());
try {
// set up SSL keystores for Stomp connection
System.setProperty("javax.net.ssl.trustStore", args[0] + "client-side-truststore.jks");
System.setProperty("javax.net.ssl.trustStorePassword", "secureexample");
System.setProperty("javax.net.ssl.keyStore", args[0] + "client-side-keystore.jks");
System.setProperty("javax.net.ssl.keyStorePassword", "secureexample");
// Step 1. Create an SSL socket to connect to the broker
SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket socket = (SSLSocket) sslsocketfactory.createSocket("localhost", 5500);
@ -114,6 +115,11 @@ public class StompDualAuthenticationExample {
if (connection != null) {
connection.close();
}
System.clearProperty("javax.net.ssl.trustStore");
System.clearProperty("javax.net.ssl.trustStorePassword");
System.clearProperty("javax.net.ssl.keyStore");
System.clearProperty("javax.net.ssl.keyStorePassword");
}
}

View File

@ -31,7 +31,7 @@ under the License.
<!-- Acceptors -->
<acceptors>
<acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
<acceptor name="netty-ssl-acceptor">tcp://localhost:5500?sslEnabled=true;needClientAuth=true;keyStorePath=${data.dir}/../etc/server-side-keystore.jks;keyStorePassword=secureexample;trustStorePath=${data.dir}/../etc/server-side-truststore.jks;trustStorePassword=secureexample</acceptor>
<acceptor name="netty-ssl-acceptor">tcp://localhost:5500?sslEnabled=true;needClientAuth=true;keyStorePath=server-side-keystore.jks;keyStorePassword=secureexample;trustStorePath=server-side-truststore.jks;trustStorePassword=secureexample</acceptor>
</acceptors>
<!-- Other config -->
@ -47,7 +47,7 @@ under the License.
<addresses>
<address name="exampleQueue">
<anycast>
<queue name="jms.queue.exampleQueue"/>
<queue name="exampleQueue"/>
</anycast>
</address>
</addresses>

View File

@ -29,7 +29,7 @@ under the License.
<artifactId>stomp-jms</artifactId>
<packaging>jar</packaging>
<name>ActiveMQ Artemis JMS Stomp JMS Example</name>
<name>ActiveMQ Artemis Stomp JMS Example</name>
<properties>
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>

View File

@ -43,7 +43,7 @@ public class StompExample {
connection.start();
System.out.println("Waiting 20 seconds");
System.out.println("Waiting 10 seconds");
Thread.sleep(10000); // increase this and it will fail
System.out.println("waited");

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
<core xmlns="urn:activemq:core">
<bindings-directory>./data/messaging/bindings</bindings-directory>
<journal-directory>./data/messaging/journal</journal-directory>
<large-messages-directory>./data/messaging/largemessages</large-messages-directory>
<paging-directory>./data/messaging/paging</paging-directory>
<acceptors>
<acceptor name="netty-acceptor">tcp://localhost:61616?anycastPrefix=/queue/</acceptor>
</acceptors>
<security-settings>
<security-setting match="#">
<permission roles="guest" type="consume"/>
<permission roles="guest" type="send"/>
<permission roles="guest" type="createAddress"/>
<permission roles="guest" type="createDurableQueue"/>
</security-setting>
</security-settings>
</core>
</configuration>

View File

@ -46,8 +46,6 @@ public class StompExample {
// Step 2. Send a CONNECT frame to connect to the server
String connectFrame = "CONNECT\n" +
"login: guest\n" +
"passcode: guest\n" +
"request-id: 1\n" +
"\n" +
END_OF_FRAME;

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
<core xmlns="urn:activemq:core">
<bindings-directory>./data/messaging/bindings</bindings-directory>
<journal-directory>./data/messaging/journal</journal-directory>
<large-messages-directory>./data/messaging/largemessages</large-messages-directory>
<paging-directory>./data/messaging/paging</paging-directory>
<acceptors>
<acceptor name="netty-acceptor">tcp://localhost:61616?protocols=CORE</acceptor>
<acceptor name="stomp-acceptor">tcp://localhost:61613?protocols=STOMP</acceptor>
</acceptors>
<security-settings>
<security-setting match="#">
<permission type="send" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="createAddress" roles="guest"/>
<permission type="createDurableQueue" roles="guest"/>
</security-setting>
</security-settings>
<address-settings>
<address-setting match="#">
<default-address-routing-type>ANYCAST</default-address-routing-type>
<default-queue-routing-type>ANYCAST</default-queue-routing-type>
</address-setting>
</address-settings>
</core>
</configuration>

View File

@ -48,8 +48,6 @@ public class StompExample {
String connectFrame = "CONNECT\n" +
"accept-version:1.1\n" +
"host:localhost\n" +
"login:guest\n" +
"passcode:guest\n" +
"request-id:1\n" +
"\n" +
END_OF_FRAME;
@ -63,6 +61,7 @@ public class StompExample {
String text = "Hello World from Stomp 1.1 !";
String message = "SEND\n" +
"destination:exampleQueue\n" +
"destination-type:ANYCAST\n" +
"\n" +
text +
END_OF_FRAME;

View File

@ -48,8 +48,6 @@ public class StompExample {
String connectFrame = "CONNECT\n" +
"accept-version:1.2\n" +
"host:localhost\n" +
"login:guest\n" +
"passcode:guest\n" +
"request-id:1\n" +
"\n" +
END_OF_FRAME;
@ -63,6 +61,7 @@ public class StompExample {
String text = "Hello World from Stomp 1.2 !";
String message = "SEND\n" +
"destination:exampleQueue\n" +
"destination-type:ANYCAST\n" +
"\n" +
text +
END_OF_FRAME;