Author: Michel Erard
A little demo that show how you can run a message driven bean as a kind of a singleton.
All you need to build this project is Java 7.0 (Java SDK 1.7) or better, Maven 3.1 or better.
The application this project produces is designed to be run on JBoss WildFly.
For this example we start the JBoss with the full profile to have the messaging subsystem up and running.
-
Open a command line and navigate to the root of the JBoss server directory.
-
The following shows the command line to start the server with the web profile:
For Linux: JBOSS_HOME/bin/standalone.sh -c standalone-full.xml For Windows: JBOSS_HOME\bin\standalone.bat -c standalone-full.xml
-
Make sure you have started the JBoss Server as described above.
-
Open a command line and navigate to the root directory of this project.
-
Type this command to build and deploy the archive:
mvn clean package wildfly:execute-commands wildfly:deploy
-
This will add a single-instance bean pool to the standalone-full.xml and deploy
target/singleton-mdb-example.war
to the running instance of the server.
The application will be running at the following URL: http://localhost:8080/singleton-mdb-example/.
To send a message: http://localhost:8080/singleton-mdb-example/rest/message/put_your_message_here
-
Make sure you have started the JBoss Server as described above.
-
Open a command line and navigate to the root directory of this project.
-
When you are finished testing, type this command to undeploy the archive:
mvn wildfly:undeploy