You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: helloworld-mdb/README.md
+220-1Lines changed: 220 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,7 @@ This project creates two JMS resources:
20
20
* A queue named `HELLOWORLDMDBQueue` bound in JNDI as `java:/queue/HELLOWORLDMDBQueue`
21
21
* A topic named `HELLOWORLDMDBTopic` bound in JNDI as `java:/topic/HELLOWORLDMDBTopic`
22
22
23
+
These destinations are automatically created when the project is deployed on WildFly thanks to the [src/main/webapp/WEB-INF/hornetq-jms.xml](hornetq-jms.xml file).
23
24
24
25
System requirements
25
26
-------------------
@@ -48,7 +49,7 @@ Start WildFly 8 with the Full Profile
48
49
Build and Deploy the Quickstart
49
50
-------------------------
50
51
51
-
_NOTE: The following build command assumes you have configured your Maven user settings. If you have not, you must include Maven setting arguments on the command line. See [Build and Deploy the Quickstarts](../README.md#buildanddeploy) for complete instructions and additional options._
52
+
_NOTE: The following build command assumes you have configured your Maven user settings. If you have not, you must include Maven setting arguments on the command line. See [Build and Deploy the Quickstarts](../README.md#build-and-deploy-the-quickstarts) for complete instructions and additional options._
52
53
53
54
1. Make sure you have started the JBoss Server as described above.
54
55
2. Open a command line and navigate to the root directory of this quickstart.
@@ -101,3 +102,221 @@ If you want to debug the source code or look at the Javadocs of any library in t
101
102
102
103
mvn dependency:sources
103
104
mvn dependency:resolve -Dclassifier=javadoc
105
+
106
+
107
+
Build and Deploy the Quickstart - to OpenShift
108
+
-------------------------
109
+
110
+
### Create an OpenShift Account and Domain
111
+
112
+
If you do not yet have an OpenShift account and domain, [Sign in to OpenShift](https://openshift.redhat.com/app/login) to create the account and domain. [Get Started with OpenShift](https://openshift.redhat.com/app/getting_started) will show you how to install the OpenShift Express command line interface.
113
+
114
+
### Create the OpenShift Application
115
+
116
+
Open a shell command prompt and change to a directory of your choice. Enter the following command for quickstarts running on WildFly 8:
The domain name for this application will be `helloworldmdb-<YOUR_DOMAIN_NAME>.rhcloud.com`. Here we use the _quickstart_ domain. You will need to replace it with your own OpenShift domain name.
121
+
122
+
This command creates an OpenShift application called `helloworldmdb` and will run the application inside the `wildfly-8` container. You should see some output similar to the following:
123
+
124
+
The cartridge 'https://cartreflect-claytondev.rhcloud.com/reflect?github=openshift-cartridges/openshift-wildfly-cartridge' will
Your application 'helloworldmdb' is now available.
139
+
140
+
Run 'rhc show-app helloworldmdb' for more details about your app.
141
+
142
+
The create command creates a git repository in the current directory with the same name as the application. Notice that the output also reports the URL at which the application can be accessed. Make sure it is available by typing the published url <http://helloworldmdb-quickstart.rhcloud.com/> into a browser or use command line tools such as curl or wget. Be sure to replace the `quickstart` in the URL with your domain name.
143
+
144
+
### Configure the OpenShift Server
145
+
146
+
The messaging subsystem is not enabled by default in the `.openshift/config/standalone.xml`.
147
+
148
+
We must add this messaging subsystem to be able to use JMS from OpenShift.
149
+
150
+
Edit `.openshift/config/standalone.xml` and add the `org.jboss.as.messaging` to the extension list:
151
+
152
+
<extension module="org.jboss.as.messaging"/>
153
+
154
+
In the `ejb3` subsystem configuration, you also need to add configuration for the Message-Driven Beans in the `<mdb>` element:
Once the `standalone.xml` is edited, we can commit the file to Git and push to OpenShift to restart WildFly 8 with this configuration:
245
+
246
+
git add .openshift/config/standalone.xml
247
+
git ci -m "add messaging subsystem to WildFly standalone configuration"
248
+
git push
249
+
250
+
Once the push command returns, WildFly 8 has been restarted with the messaging configuration.
251
+
252
+
### Migrate the Quickstart Source
253
+
254
+
Now that you have confirmed it is working you can migrate the quickstart source. You do not need the generated default application, so navigate to the new git repository directory and tell git to remove the source and pom files:
255
+
256
+
git rm -r src pom.xml
257
+
258
+
Copy the source for the `helloworld-mdb` quickstart into this new git repository:
259
+
260
+
cp -r QUICKSTART_HOME/helloworld-mdb/src .
261
+
cp QUICKSTART_HOME/helloworld-mdb/pom.xml .
262
+
263
+
The `helloworld-mdb` POM file needs to be changed slightly to be able to build and deploy the project from this new location.
264
+
265
+
Edit the copied `pom.xml`, remove the `<parent>` element and add `<groupId>` and `<version>` elements:
266
+
267
+
<groupId>org.wildfly.quickstarts</groupId>
268
+
<artifactId>wildfly-helloworld-mdb</artifactId>
269
+
<packaging>war</packaging>
270
+
<version>8.0.0-SNAPSHOT</version>
271
+
<name>WildFly Quickstarts: Helloworld Message-Driven Bean with Servlet 3.0 as client</name>
You can now deploy the changes to your OpenShift application using git as follows:
283
+
284
+
git add src pom.xml .openshift
285
+
git commit -m "helloworld-mdb quickstart on OpenShift"
286
+
git push
287
+
288
+
The final push command triggers the OpenShift infrastructure to build and deploy the changes.
289
+
290
+
Note that the `openshift` profile in the `pom.xml` file is activated by OpenShift. This causes the WAR built by OpenShift to be copied to the `deployments` directory and deployed without a context path.
291
+
292
+
### Test the OpenShift Application
293
+
294
+
When the push command returns you can test the application by getting the following URL either via a browser or using tools such as curl or wget. Be sure to replace the `quickstart` in the URL with your domain name.
295
+
296
+
*<http://helloworldmdb-quickstart.rhcloud.com/> to send messages to the queue
297
+
*<http://helloworldmdb-quickstart.rhcloud.com/HelloWorldMDBServletClient?topic> to send messages to the topic
298
+
299
+
If the application has run succesfully you should see some output in the browser.
300
+
301
+
Now you can look at the output of the server by running the following command:
302
+
303
+
rhc tail -a helloworldmdb
304
+
305
+
This will show the tail of the servers log which should show something like the following.
306
+
307
+
2012/03/02 05:52:33,065 INFO [class org.jboss.as.quickstarts.mdb.HelloWorldMDB] (Thread-0 (HornetQ-client-global-threads-1772719)) Received Message from queue: This is message 4
308
+
2012/03/02 05:52:33,065 INFO [class org.jboss.as.quickstarts.mdb.HelloWorldMDB] (Thread-1 (HornetQ-client-global-threads-1772719)) Received Message from queue: This is message 1
309
+
2012/03/02 05:52:33,067 INFO [class org.jboss.as.quickstarts.mdb.HelloWorldMDB] (Thread-6 (HornetQ-client-global-threads-1772719)) Received Message from queue: This is message 5
310
+
2012/03/02 05:52:33,065 INFO [class org.jboss.as.quickstarts.mdb.HelloWorldMDB] (Thread-3 (HornetQ-client-global-threads-1772719)) Received Message from queue: This is message 3
311
+
2012/03/02 05:52:33,065 INFO [class org.jboss.as.quickstarts.mdb.HelloWorldMDB] (Thread-2 (HornetQ-client-global-threads-1772719)) Received Message from queue: This is message 2
312
+
313
+
314
+
You can use the OpenShift command line tools or the OpenShift web console to discover and control the application.
315
+
316
+
### Delete the OpenShift Application
317
+
318
+
When you are finished with the application you can delete it as follows:
319
+
320
+
rhc app-delete -a helloworldmdb
321
+
322
+
_Note_: There is a limit to the number of applications you can deploy concurrently to OpenShift. If the `rhc app create` command returns an error indicating you have reached that limit, you must delete an existing application before you continue.
0 commit comments