Skip to content

Commit

Permalink
Major re-work of JMS quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Bertram authored and pmuir committed Mar 22, 2012
1 parent bc69923 commit a9aa3c6
Show file tree
Hide file tree
Showing 4 changed files with 205 additions and 253 deletions.
89 changes: 47 additions & 42 deletions helloworld-jms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,74 +6,79 @@ The example provides a demonstration of both producing and consuming messages to
a JMS destination deployed in the JBoss AS 7 environment. The example can be run from the Maven
commandline, or from the Eclipse environment.

To run the example from the commandline simply type:
However, before the example can be run successfully please follow the instructions in the
"Add a Management or Application User" section of the parent README.md.

By default, the JMS messaging provider is not deployed with the standalone JBoss AS 7 server. You will either need to run
a domain server, or configure the standalone server for JMS message. Please refer to the JBoss AS 7 Documentation for further details.

To run the standalone server with JMS enabled:

standalone.sh -c standalone-full.xml

To run the quickstart from the commandline:

mvn compile exec:java

If the quickstart is successful with the default configuration you will see output similar to this:

Mar 14, 2012 1:38:58 PM org.jboss.as.quickstarts.jms.HelloWorldJMSClient main
INFO: Attempting to acquire connection factory "jms/RemoteConnectionFactory"
Mar 14, 2012 1:38:58 PM org.jboss.as.quickstarts.jms.HelloWorldJMSClient main
INFO: Found connection factory "jms/RemoteConnectionFactory" in JNDI
Mar 14, 2012 1:38:58 PM org.jboss.as.quickstarts.jms.HelloWorldJMSClient main
INFO: Attempting to acquire destination "jms/queue/test"
Mar 14, 2012 1:38:58 PM org.jboss.as.quickstarts.jms.HelloWorldJMSClient main
INFO: Found destination "jms/queue/test" in JNDI
Mar 14, 2012 1:38:58 PM org.jboss.as.quickstarts.jms.HelloWorldJMSClient main
INFO: Sending 1 messages with content: Hello, World!
Mar 14, 2012 1:38:58 PM org.jboss.as.quickstarts.jms.HelloWorldJMSClient main
INFO: Received message with content Hello, World!

The example provides for a certain amount of customization for the `mvn:exec` plugin via system properties explained below:


Required Properties
Optional Properties
-------------------

* `connection.type`
* `username`

Which connection type to the JMS provider you want to use. Accepted values are `netty` or `jndi`.
This username is used for both the JMS connection and the JNDI look-up. See the instructions in the
"Add a Management or Application User" section of the parent README.md for more information.

Default: `netty`

*Note:* Currently external JNDI access is under development in JBoss AS 7. As a result netty is the default value.
Default: `quickstartUser`

* `java.naming.factory.initial`
* `password`

The JNDI initial context factory you wish to use
This password is used for both the JMS connection and the JNDI look-up. See the instructions in the
"Add a Management or Application User" section of the parent README.md for more information.

Default: `org.jboss.as.naming.InitialContextFactory`

* `java.naming.provider.url`

The provider URL of the JNDI context you wish to use

Default: `jnp://localhost:1099`

Default: `quickstartPassword`

Optional Properties
-------------------
* `connection.factory`

* `cf.name`
The name of the JMS ConnectionFactory you want to use.

The JNDI name of the JMS ConnectionFactory you want to use.
Default: `jms/RemoteConnectionFactory`

Default: `RemoteConnectionFactory`
* `destination`

* `dest.name`

The JNDI name of the JMS Destination you want to use.
The name of the JMS Destination you want to use.

Default: `testQueue`

* `message.content`

The content of the JMS TextMessage.

Default: `"Hello, World!"`
Default: `jms/queue/test`

* `message.count`

The number of JMS messages you want to produce and consume.
The number of JMS messages you want to produce and consume.

Default: `1`


Deployment Note
---------------
Default: `1`

By default, the JMS messaging provider is not deployed with the standalone JBoss AS 7 server. You will either need to run
a domain server, or configure the standalone server for JMS message. Please refer to the JBoss AS 7 Documentation for further details.
* `message.content`

To run the standalone server with JMS Messaging enabled
The content of the JMS TextMessage.

Default: `"Hello, World!"`

standalone.sh -c standalone-full.xml



Expand Down
216 changes: 110 additions & 106 deletions helloworld-jms/pom.xml
Original file line number Diff line number Diff line change
@@ -1,106 +1,110 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.jboss.as.quickstarts</groupId>
<artifactId>jboss-as-helloworld-jms</artifactId>
<version>7.1.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>JBoss AS Quickstarts: helloworld-jms</name>
<description>helloworld-jms: Helloworld JMS external producer/consumer client </description>

<url>http://jboss.org/jbossas</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<distribution>repo</distribution>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
</license>
</licenses>

<properties>
<!-- Explicitly declaring the source encoding eliminates the following
message: -->
<!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
resources, i.e. build is platform dependent! -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-naming</artifactId>
<version>7.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.jms</groupId>
<artifactId>jboss-jms-api_1.1_spec</artifactId>
<version>1.0.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-messaging</artifactId>
<version>7.1.0.Final</version>
</dependency>
</dependencies>

<build>
<finalName>jboss-as-helloworld-jms</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<mainClass>org.jboss.as.quickstarts.jms.HelloWorldJMSClient</mainClass>
<systemProperties>
<systemProperty>
<key>connection.type</key>
<value>netty</value>
</systemProperty>
<systemProperty>
<key>java.naming.factory.initial</key>
<value>org.jboss.as.naming.InitialContextFactory</value>
</systemProperty>
<systemProperty>
<key>java.naming.provider.url</key>
<value>jnp://localhost:1099</value>
</systemProperty>
<systemProperty>
<key>java.logging.config.file</key>
<value>./helloworld-jms-logging.properties</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<configuration>
</configuration>
</plugin>
<!-- JBoss AS plugin to deploy war -->
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.1.0.Final</version>
<configuration>
<username>admin</username>
<password>admin</password>
</configuration>
</plugin>
<!-- Compiler plugin enforces Java 1.6 compatibility and activates
annotation processors -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.jboss.as.quickstarts</groupId>
<artifactId>jboss-as-helloworld-jms</artifactId>
<version>7.1.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>JBoss AS Quickstarts: helloworld-jms</name>
<description>helloworld-jms: Helloworld JMS external producer/consumer client</description>

<url>http://jboss.org/jbossas</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<distribution>repo</distribution>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
</license>
</licenses>

<properties>
<!-- Explicitly declaring the source encoding eliminates the following
message: -->
<!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
resources, i.e. build is platform dependent! -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-jms-client-bom</artifactId>
<version>7.1.1.Final</version>
<type>pom</type>
</dependency>
</dependencies>

<build>
<finalName>jboss-as-helloworld-jms</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<mainClass>org.jboss.as.quickstarts.jms.HelloWorldJMSClient</mainClass>
<systemProperties>
<!-- Ensure you add a user with these credentials to the "guest" role in the "ApplicationRealm" using bin/add-user.sh - ->
<systemProperty>
<key>username</key>
<value>quickstartUser</value>
</systemProperty>
<systemProperty>
<key>password</key>
<value>quickstartPassword</value>
</systemProperty-->
<!--systemProperty>
<key>connection.factory</key>
<value>jms/RemoteConnectionFactory</value>
</systemProperty>
<systemProperty>
<key>destination</key>
<value>jms/queue/test</value>
</systemProperty>
<systemProperty>
<key>message.count</key>
<value>1</value>
</systemProperty>
<systemProperty>
<key>message.content</key>
<value>Hello, World!</value>
</systemProperty-->
<systemProperty>
<key>java.logging.config.file</key>
<value>./helloworld-jms-logging.properties</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<configuration>
</configuration>
</plugin>
<!-- JBoss AS plugin to deploy war -->
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.1.0.Final</version>
<configuration>
<username>admin</username>
<password>admin</password>
</configuration>
</plugin>
<!-- Compiler plugin enforces Java 1.6 compatibility and activates
annotation processors -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
>>>>>>> Major re-work of JMS quickstart
Loading

0 comments on commit a9aa3c6

Please sign in to comment.