This closes #470

This commit is contained in:
Clebert Suconic 2016-04-18 17:50:53 -04:00
commit 1363d6eee3
1 changed files with 29 additions and 24 deletions

View File

@ -1,11 +1,10 @@
Examples
========
The Apache ActiveMQ Artemis distribution comes with over 90 run out-of-the-box examples
demonstrating many of the features.
The Apache ActiveMQ Artemis distribution comes with over 90 run out-of-the-box examples demonstrating many of the features.
The examples are available in both the binary and source distribution under the `examples`
directory. Examples are split by the following source tree:
The examples are available in both the binary and source distribution under the `examples` directory. Examples are split
by the following source tree:
- features - Examples containing broker specific features.
- ha - examples showing failover and reconnection capabilities.
@ -18,42 +17,50 @@ directory. Examples are split by the following source tree:
- stomp
- amqp
A set of Java EE examples are also provided which need WildFly installed
to be able to run.
A set of Java EE examples are also provided which need WildFly installed to be able to run.
Examples
========
Runnning the Examples
=====================
To run any example, simply `cd` into the appropriate example directory
and type `mvn verify` or `mvn install` (For details please read the readme.html in each
example directory).
To run any example, simply `cd` into the appropriate example directory and type `mvn verify` or `mvn install` (For
details please read the readme.html in each example directory).
You can use the profile -Pexamples to run multiple examples under any example tree.
You can use the profile `-Pexamples` to run multiple examples under any example tree.
For each server, you will have a created server under ./target/server0 (some examples use more than one server).
For each server, you will have a created server under `./target/server0` (some examples use more than one server).
You have the option to disable the server running (say if you want to start the server manually) by simply specifying the -PnoServer profile
This will run the example without a server:
You have the option to prevent the example from starting the server (e.g. if you want to start the server manually) by
simply specifying the `-PnoServer` profile, e.g.:
``` sh
# running an example without running the server
mvn verify -PnoServer
```
Also under ./target there will be a script repeating the commands to create each server:
Also under `./target` there will be a script repeating the commands to create each server. Here is the `create-server0.sh`
generated by the `Queue` example. This is useful to see exactly what command(s) are required to configure the server(s).
Example this is create-server0.sh created for the queue example. It could be useful to see what we do on the example:
```sh
# These are the commands used to create server0
/myInstallDirectory/apache-artemis-1.1.0/bin/artemis create --allow-anonymous --silent --force --no-web --user guest --password guest --role guest --port-offset 0 --data ./data --allow-anonymous --no-autotune --verbose /myInstallDirectory/apache-artemis-1.1.0/examples/features/standard/queue/target/server0
```
These examples are all using the [Maven plugin](maven-plugin.md), which can be useful for running your test servers as well.
Several examples use UDP clustering which may not work in your environment by default. On linux the command would be:
``` sh
route add -net 224.0.0.0 netmask 240.0.0.0 dev lo
```
This command should be run as root. This will redirect any traffic directed to `224.0.0.0` to the loopback interface.
On Mac OS X, the command is slightly different:
This is the common output when running an example. On this case taken from the Queue example:
``` sh
sudo route add 224.0.0.0 127.0.0.1 -netmask 240.0.0.0
```
All the examples use the [Maven plugin](maven-plugin.md), which can be useful for running your test servers as well.
This is the common output when running an example. On this case taken from the `Queue` example:
```sh
[INFO] Scanning for projects...
@ -187,14 +194,12 @@ server-out:17:30:27,476 INFO [org.apache.activemq.artemis.core.server] AMQ22100
[INFO] Finished at: 2015-09-01T17:30:27-04:00
[INFO] Final Memory: 42M/508M
[INFO] ------------------------------------------------------------------------
```
Applet
------
This example shows you how to send and receive JMS messages from an
Applet.
This example shows you how to send and receive JMS messages from an Applet.
Application-Layer Failover
--------------------------