Integrating with JBoss Enterprise Application Platform
Installing the ActiveMQ resource adapter into the JBoss Enterprise Application Platform container
Copyright © 2011-2014 Red Hat, Inc. and/or its affiliates.
Abstract
Chapter 1. Deploying the Apache ActiveMQ Resource Adapter
Abstract
helloworld-mdb demonstration as an example.
1.1. Supported Web Server Platforms
Overview
- JBoss Enterprise Application Platform (JBoss EAP)
Supported product versions
1.2. Install the ActiveMQ Resource Adapter
Overview
Resource adapter location
activemq-rar-5.9.0.redhat-610379.rar, at either of the following locations:
- In the following Zip archive file:
InstallDir/extras/apache-activemq-5.9.0.redhat-610379-bin.zip
After expanding the archive, the resource adapter file can be found in the following sub-directory:apache-activemq-5.9.0.redhat-610379/lib/optional
- Directly from the Red Hat JBoss Fuse Maven repository, at the following URL:
http://repo.fusesource.com/nexus/content/groups/public/org/apache/activemq/activemq-rar/
Download the.rararchive file from the appropriately versioned sub-directory, 5.9.0.redhat-610379.
Configuration files
InstallDir/standalone/configuration/standalone.xml- The
standalone.xmlfile is the default (bare bones) configuration for the JBoss Enterprise Application Platform container. You must edit this file to complete the installation of the ActiveMQ resource adapter.NoteIt is assumed that this file does not already configure the HornetQ messaging system (which would conflict with the ActiveMQ messaging system).
standalone/configuration/standalone.xml, or as a managed domain, using domain/configuration/domain.xml. Throughout this section, we describe explicitly how to configure the standalone container, but it is understood that a similar approach could be used to configure a managed domain.
Steps to install the resource adapter
- Extract the Apache ActiveMQ community distribution. You can find an archive of the Apache ActiveMQ distribution in the following location:
InstallDir/extras/apache-activemq-5.9.0.redhat-610379-bin.zip
Using a suitable archive utility, extract the preceding archive file to any convenient location on your filesystem. The root of the extracted directory tree is calledapache-activemq-5.9.0.redhat-610379by default. - The ActiveMQ resource adapter archive file can now be found under the
/lib/optionalsub-directory of the archive extracted in the previous step. Make a copy of the ActiveMQ resource adapter archive file, omitting the version number in the filename. For example, on a UNIX or Linux platform, you can rename theactivemq-rar-5.9.0.redhat-610379.rararchive file as follows:cd apache-activemq-5.9.0.redhat-610379/lib/optional cp activemq-rar-5.9.0.redhat-610379.rar activemq-rar.rar
NoteRenaming the resource adapter archive in this way is not strictly necessary. But because the resource adapter file name appears in the resource adapter configuration, using a versionless filename makes it easier to upgrade the resource adapter at a later date. - Install the ActiveMQ resource adapter by copying the resource adapter archive,
activemq-rar.rar, to the relevant JBoss Enterprise Application Platform deployment directory. For example, on a UNIX or Linux platform, you could copy the resource adapter archive to a standalone JBoss Enterprise Application Platform as follows:cp activemq-rar.rar EAPInstallDir/standalone/deployments/
- Add the requisite resource adapter configuration to the
urn:jboss:domain:resource-adapters:1.1subsystem in the JBoss Enterprise Application Platform configuration, as follows.Open theEAPInstallDir/standalone/configuration/standalone.xmlfile using a text editor and paste theresource-adapterelement from Example 1.1, “ActiveMQ Resource Adapter Configuration in standalone.xml” into theurn:jboss:domain:resource-adapters:1.1subsystem, as a child of theresource-adapterselement.Example 1.1. ActiveMQ Resource Adapter Configuration in standalone.xml
<server xmlns="urn:jboss:domain:1.4"> ... <profile> ... <subsystem xmlns="urn:jboss:domain:resource-adapters:1.1"> <resource-adapters> <resource-adapter id="activemq-rar.rar"> <archive> activemq-rar.rar </archive> <transaction-support>XATransaction</transaction-support> <config-property name="UserName"> defaultUser </config-property> <config-property name="Password"> defaultPassword </config-property> <config-property name="ServerUrl"> tcp://localhost:61616?jms.rmIdFromConnectionId=true </config-property> <connection-definitions> <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/ConnectionFactory" enabled="true" pool-name="ConnectionFactory"> <xa-pool> <min-pool-size>1</min-pool-size> <max-pool-size>20</max-pool-size> <prefill>false</prefill> <is-same-rm-override>false</is-same-rm-override> </xa-pool> <recovery> <recover-credential> <user-name>defaultUser</user-name> <password>defaultPassword</password> </recover-credential> </recovery> </connection-definition> </connection-definitions> <admin-objects> <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/queue/HELLOWORLDMDBQueue" use-java-context="true" pool-name="HELLOWORLDMDBQueue"> <config-property name="PhysicalName"> HELLOWORLDMDBQueue </config-property> </admin-object> <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/HELLOWORLDMDBTopic" use-java-context="true" pool-name="HELLOWORLDMDBTopic"> <config-property name="PhysicalName"> HELLOWORLDMDBTopic </config-property> </admin-object> </admin-objects> </resource-adapter> ... </resource-adapters> </subsystem> ... </profile> ... </server>If your resource adapter archive filename differs fromactivemq-rar.rar, you must change the content of thearchiveelement in the preceding configuration to match the name of your archive file.The values of theUserNameandPasswordconfiguration properties must be chosen to match the credentials of a valid user in the external broker.You might need to change the value of theServerUrlconfiguration property to match the actual hostname and port exposed by the external broker.ImportantIn order to ensure that JMS transactions are integrated correctly, it is essential to include thejms.rmIdFromConnectionId=trueoption setting on theServerUrlconfiguration property and to include the<is-same-rm-override>false</is-same-rm-override>setting in thexa-poolelement, as shown above.NoteThe JMS administrative objects defined in theadmin-objectselement do not need to be defined yet. They serve as examples to show how you can define administrative objects for the ActiveMQ resource adapter (they are used later in the message-driven bean demonstration). - Add the requisite message driven bean configuration to the
urn:jboss:domain:ejb3:1.4subsystem in the JBoss Enterprise Application Platform configuration.Open theEAPInstallDir/standalone/configuration/standalone.xmlfile using a text editor and paste themdbelement from Example 1.2, “Message Driven Bean Configuration in standalone.xml” into theurn:jboss:domain:ejb3:1.4subsystem.Example 1.2. Message Driven Bean Configuration in standalone.xml
<server xmlns="urn:jboss:domain:1.4"> ... <profile> ... <subsystem xmlns="urn:jboss:domain:ejb3:1.4"> ... <mdb> <resource-adapter-ref resource-adapter-name="activemq-rar.rar"/> <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/> </mdb> <pools> <bean-instance-pools> <strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/> <strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/> </bean-instance-pools> </pools> ... </subsystem> ... </profile> ... </server> - Before starting the broker, check the broker configuration to make sure that there are valid user credentials defined in the broker's
InstallDir/etc/users.propertiesfile. For example, to match theUserNameandPasswordcredentials configured in Example 1.1, “ActiveMQ Resource Adapter Configuration in standalone.xml”, theusers.propertiesfile should contain an entry like the following:defaultUser=defaultPassword,admin
- Start the external A-MQ broker. For example, on a UNIX or Linux platform, you can start the JBoss A-MQ broker instance as follows:
cd InstallDir/bin ./amq
- Start the standalone instance of JBoss Enterprise Application Platform. For example, on a UNIX or Linux platform, you can start the standalone instance as follows:
cd EAPInstallDir/bin ./standalone.sh
Resource adapter configuration
config-property element to set resource adapter properties. The ActiveMQ resource adapter supports the following basic properties:
UserName- (Optional) Specifies the client username when connecting to the JBoss A-MQ broker (not required in this example, because the JBoss A-MQ broker configuration does not enable authentication).
Password- (Optional) Specifies the client password when connecting to the JBoss A-MQ broker (not required in this example, because the JBoss A-MQ broker configuration does not enable authentication).
ServerUrl- Specifies the URL used to connect to the JBoss A-MQ broker instance. This value must match one of the endpoints specified by a
transportConnectorelement in the JBoss A-MQ broker configuration. BrokerXmlConfig- (Optional) Specifies the location of an embedded broker's XML configuration file. To specify a location on the file system, use the format,
xbean:file://AbsolutePath, where the path,AbsolutePath, should be specified as an absolute pathname. UseInboundSession- (Optional) Sets a flag that specifies whether outbound connections should reuse the inbound connection's session for sending messages (useful for connections going through a firewall). Defaults to
false. Clientid- (Optional) Specifies a JMS client ID, which the resource adapter uses for the connection from the JBoss Enterprise Application Platform container.
JBoss A-MQ broker configuration
InstallDir/etc/activemq.xml
- Configuring Broker Persistence
- Tuning Guide
- Security Guide
- XML Configuration Reference
1.3. Integrating with an ActiveMQ Failover Cluster
Overview
Failover URL
ServerUrl configuration property with a failover URL, which lists the available endpoints in the cluster. The general form of the failover URL you should use is as follows:
failover:(uri1,...,uriN)?maxReconnectAttempts=0
maxReconnectAttempts=0, in order to ensure a clean cutover when the master fails in a master/slave high-availability cluster.
Sample scenario
amqhostA and a broker running on host amqhostB are configured to run as a high-availability master/slave cluster. In this scenario, the brokers expose the following TCP endpoints:
tcp://amqhostA:61616 tcp://amqhostB:61616
failover:(tcp://amqhostA:61616,tcp://amqhostB:61616)?jms.rmIdFromConnectionId=true&maxReconnectAttempts=0
& symbol as & giving the URL:
failover:(tcp://amqhostA:61616,tcp://amqhostB:61616)?jms.rmIdFromConnectionId=true&maxReconnectAttempts=0
Configuring the ActiveMQ resource adapter for failover
- Set the
ServerUrlconfiguration property to a correctly configured failover URL, - Set the
UseInboundSessionconfiguration property totruefor inbound connections (set as the direct child of theresource-adapterelement), and - Set the
UseInboundSessionconfiguration property tofalsefor the connection factories (set as the child of aconnection-definitionelement).
EAPInstallDir/standalone/configuration/standalone.xml file using a text editor, search for the urn:jboss:domain:resource-adapters:1.1 subsystem, and modify the ServerUrl property and the UseInboundSession property as shown in Example 1.3, “ActiveMQ Resource Adapter Configuration for Failover”. You will need to customize the value of the failover URL, as appropriate, to match the configuration of your broker cluster.
Example 1.3. ActiveMQ Resource Adapter Configuration for Failover
<server xmlns="urn:jboss:domain:1.4">
...
<profile>
...
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.1">
<resource-adapters>
<resource-adapter id="activemq-rar.rar">
...
<config-property name="ServerUrl">
failover:(tcp://amqhostA:61616,tcp://amqhostB:61616)?jms.rmIdFromConnectionId=true&maxReconnectAttempts=0
</config-property>
...
<config-property name="UseInboundSession">
true
</config-property>
...
<connection-definitions>
<connection-definition ... >
...
<config-property name="UseInboundSession">
false
</config-property>
...
</connection-definition>
</connection-definitions>
...
</resource-adapter>
...
</resource-adapters>
</subsystem>
...
</profile>
...
</server>1.4. Install JBoss AS Quickstarts
Overview
- JBoss EAP Maven repository—an offline Maven repository for JBoss Enterprise Application Platform, which contains the dependencies required by the quickstart examples.
- JBoss AS Quickstart examples—the quickstart examples themselves.
Prerequisites
- Subscription—you must have a Red Hat subscription that includes support for the JBoss Enterprise Application Platform product (or ask Red Hat support for access as part of an evaluation).
- Maven installation—you must have Apache Maven installed and the version must be 3.0.0 or later. You can get the latest copy of Maven from the Maven download page.
- Internet access—Maven is a distributed build system, which downloads packages from the Internet on the fly, whenever they are needed during a build. Consequently, you must have access to the Internet while performing a Maven build.
JBoss AS Quickstarts download location
jboss-eap-6.1.0-quickstarts.zip file:
Maven repository download location
jboss-eap-6.1.0-maven-repository.zip file:
Steps to install JBoss AS Quickstarts
- Download the
jboss-eap-6.1.0-quickstarts.zipfile from the customer portal site. Use an archive utility to unzip the downloaded file at a convenient location on your filesystem,QuickInstallDir. - Download the
jboss-eap-6.1.0-maven-repository.zipfile from the customer portal site. Use an archive utility to unzip the downloaded file at a convenient location on your filesystem,MvnRepoInstallDir.NoteIt is essential to download and install the Maven repository on your local machine. The quickstart examples require Maven artifacts that are not available from any public repositories online. You will not be able to build the quickstart examples unless you download, install, and configure the Maven repository. - Configure Maven to use the downloaded Maven repository by editing your local repository's
settings.xmlfile (usually located at~/.m2/settings.xmlon Linux and UNIX systems, or atC:\Documents and Settings\Username\.m2\settings.xmlon Windows). Open thesettings.xmlfile with a text editor and add the following profiles:<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <profiles> <!-- Configure the JBoss EAP Maven repository --> <profile> <id>jboss-eap-repository</id> <repositories> <repository> <id>jboss-eap-repository</id> <url>file:///path/to/jboss-eap-6.1.0.GA-maven-repository</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>jboss-eap-plugin-repository</id> <url>file:///path/to/jboss-eap-6.1.0.GA-maven-repository</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> <!-- Configure the JBoss Community Maven repository --> <profile> <id>jboss-community-repository</id> <repositories> <repository> <id>jboss-community-repository</id> <url>http://repository.jboss.org/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>jboss-community-plugin-repository</id> <url>http://repository.jboss.org/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <!-- Optionally, make the repositories active by default --> <activeProfile>jboss-eap-repository</activeProfile> <activeProfile>jboss-community-repository</activeProfile> </activeProfiles> </settings>NoteAlternatively, there is a sample settings file provided atMvnRepoInstallDir/example-settings.xmlin the downloaded Maven repository, which you can use as a template for defining yoursettings.xmlfile. - Replace all occurrences of
file:///path/to/jboss-eap-6.1.0.GA-maven-repositoryin thesettings.xmlfile with the actual location of the Maven repository on your filesystem,MvnRepoInstallDir.
Test the installation
helloworld-mdb example using Maven. Open a new command window, change directory to QuickInstallDir/helloworld-mdb, and enter the following command:
mvn clean package
BUILD SUCCESS status and the generated jboss-as-helloworld-mdb.war package will be found under the QuickInstallDir/target directory.
settings.xml file is correctly configured.
1.5. Build and Deploy the helloworld-mdb Example
Overview
helloworld-mdb quickstart example so that it works with the ActiveMQ resource adapter. You can then build and deploy the helloworld-mdb example into a standalone instance of JBoss Enterprise Application Platform (which already has an ActiveMQ resource adapter installed).
helloworld-mdb example illustrates two kinds of integration with messaging: integration of message-driven beans; and integration of a servlet (which gets access to a JMS queue and a JMS topic using the standard JMS administered objects mechanism).
Prerequisites
helloworld-mdb example:
- The ActiveMQ resource adapter is installed in the JBoss Enterprise Application Platform (as described in Section 1.2, “Install the ActiveMQ Resource Adapter”), and the installation has been verified.
- The JBoss EAP Maven repository and the JBoss AS Quickstart examples have been installed (as described in Section 1.4, “Install JBoss AS Quickstarts”).
- You have Internet access (for the Maven build).
Customizations
helloworld-mdb demonstration provided in the quickstarts distribution is integrated with the HornetQ messaging platform by default. To refactor the demonstration so that it integrates with Apache ActiveMQ, it is necessary to customize the following aspects of the helloworld-mdb code:
- Delete the HornetQ XML configuration file (located in
helloworld-mdb/src/webapp/WEB-INF/hornetq-jms.xml). - In
HelloWorldQueueMDB.java, customize the annotations on the message driven bean to integrate with the ActiveMQ resource adapter. - In
HelloWorldTopicMDB.java, customize the annotations on the message driven bean to integrate with the ActiveMQ resource adapter. - Add additional Maven dependencies.
Steps to build and deploy the example
helloworld-mdb example, perform the following steps:
- Delete the following HornetQ XML configuration file from the
helloworld-mdbproject:helloworld-mdb/src/webapp/WEB-INF/hornetq-jms.xml
- Edit the annotations on the
HelloWorldQueueMDBmessage driven bean class, so that it integrates with the ActiveMQ resource adapter (instead of HornetQ). Edit theHelloWorldQueueMDB.javafile at the following location:helloworld-mdb/src/main/java/org/jboss/as/quickstarts/mdb/HelloWorldQueueMDB.java
Open theHelloWorldQueueMDB.javafile using a text editor and make the modifications highlighted in the following extract:import org.jboss.ejb3.annotation.ResourceAdapter; ... @MessageDriven(name = "HelloWorldQueueMDB", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "HELLOWORLDMDBQueue"), @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") }) @ResourceAdapter(value="activemq-rar.rar") public class HelloWorldQueueMDB implements MessageListener { ...
Where the following changes are made to the code:- The
@ResourceAdapterannotation explicitly associates the message driven bean with the ActiveMQ resource adapter. You must include this annotation, if you want to use the ActiveMQ resource adapter. - You need to add an
importstatement for the@ResourceAdapterannotation. - The value of the
destinationproperty is changed toHELLOWORLDMDBQueue, which is the physical name of the corresponding ActiveMQ queue that this message driven bean subscribes to. The physical name of the queue is the queue identifier used by the JBoss A-MQ broker.NoteYou must specify the queue's physical name here. In contrast to the case of HornetQ, the ActiveMQ messaging integration does not allow you to use a JNDI name for thedestinationvalue.
- Edit the annotations on the
HelloWorldTopicMDBmessage driven bean class, so that it integrates with the ActiveMQ resource adapter (instead of HornetQ). Edit theHelloWorldTopicMDB.javafile at the following location:helloworld-mdb/src/main/java/org/jboss/as/quickstarts/mdb/HelloWorldTopicMDB.java
Open theHelloWorldTopicMDB.javafile using a text editor and make the modifications highlighted in the following extract:import org.jboss.ejb3.annotation.ResourceAdapter; ... @MessageDriven(name = "HelloWorldQTopicMDB", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "HELLOWORLDMDBTopic"), @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") }) @ResourceAdapter(value="activemq-rar.rar") public class HelloWorldTopicMDB implements MessageListener { ...
- Add the Maven dependency for the
jboss-ejb3-ext-apiartifact, which is needed for the@ResourceAdapterannotation. Open thehelloworld-mdb/pom.xmlfile using a text editor and add the followingdependencyelement as a child of thedependencieselement in the POM file:<project ...> ... <dependencies> ... <dependency> <groupId>org.jboss.ejb3</groupId> <artifactId>jboss-ejb3-ext-api</artifactId> <!-- to get the right version, look in the EAP offline Maven repo --> <version>2.0.0-redhat-2</version> <scope>provided</scope> </dependency> </dependencies> ... </project>Theprovidedscope value implies there is no need to embed thejboss-ejb3-ext-apiJAR file in the generated WAR, because this library is already provided by the JBoss Enterprise Application Platform container.NoteIf you ever need to update the version of thejboss-ejb3-ext-apiartifact, you can discover which version to use by drilling down to theorg/jboss/ejb3/jboss-ejb3-ext-apisub-directory of the Maven repository you downloaded and installed in Section 1.4, “Install JBoss AS Quickstarts”. - Build the
helloworld-mdbexample as follows. Open a new command prompt, change directory to thehelloworld-mdbdirectory, and enter the following Maven command:mvn clean package
If the build is successful, you should find thejboss-as-helloworld-mdb.warWAR file in thehelloworld-mdb/targetdirectory. - If you have not already done so, register the administered objects for the queues and topics used by the example, by editing the JBoss Enterprise Application Platform configuration.In your JBoss Enterprise Application Platform installation, open the
standalone/configuration/standalone.xmlconfiguration file with a text editor, and add the following highlighted administered objects to theactivemq-rar.rarresource adapter:<server xmlns="urn:jboss:domain:1.4"> ... <profile> ... <subsystem xmlns="urn:jboss:domain:resource-adapters:1.1"> <resource-adapters> <resource-adapter id="activemq-rar.rar"> ... <admin-objects> <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/queue/HELLOWORLDMDBQueue" use-java-context="true" pool-name="HELLOWORLDMDBQueue"> <config-property name="PhysicalName"> HELLOWORLDMDBQueue </config-property> </admin-object> <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/HELLOWORLDMDBTopic" use-java-context="true" pool-name="HELLOWORLDMDBTopic"> <config-property name="PhysicalName"> HELLOWORLDMDBTopic </config-property> </admin-object> </admin-objects> </resource-adapter> </resource-adapters> </subsystem> ... </profile> ... </server>Where the preceding configuration adds the following entries to the JNDI registry:java:/queue/HELLOWORLDMDBQueue- References a
javax.jms.Queueobject that connects to theHELLOWORLDMDBQueueActiveMQ queue (where the queue name on the JBoss A-MQ broker is specified by thePhysicalNameconfig property). java:/queue/HELLOWORLDMDBTopic- References a
javax.jms.Topicobject that connects to theHELLOWORLDMDBTopicActiveMQ topic (where the topic name on the JBoss A-MQ broker is specified by thePhysicalNameconfig property).
In thehelloworld-mdbexample, these administered objects are accessed by the servlet class,HelloWorldMDBServletClient(but not by the message driven bean classes). For example, theHelloWorldMDBServletClientclass injects these JNDI entries, using the@Resourceannotation, as follows:import javax.annotation.Resource; ... import javax.jms.ConnectionFactory; ... import javax.jms.Queue; import javax.jms.Topic; ... public class HelloWorldMDBServletClient extends HttpServlet { ... @Resource(mappedName = "java:/ConnectionFactory") private ConnectionFactory connectionFactory; @Resource(mappedName = "java:/queue/HELLOWORLDMDBQueue") private Queue queue; @Resource(mappedName = "java:/topic/HELLOWORLDMDBTopic") private Topic topic; ... - Deploy the
helloworld-mdbexample to the running Web server. Manually copy thejboss-as-helloworld-mdb.warWAR file from thehelloworld-mdb/targetdirectory to the Web server's deployment directory,standalone/deployments.
Access the helloworld-mdb service
helloworld-mdb service, as follows:
- If you have not already started the JBoss Enterprise Application Platform standalone container, do so by entering the following commands at the command line:
cd EAPInstallDir/bin ./standalone.sh
- You should now be able to access the
helloworld-mdbservice from your browser, by navigating to the following URL:http://localhost:8080/jboss-as-helloworld-mdb/HelloWorldMDBServletClient
When you navigate to the preceding URL, the servlet sends five messages to theHelloWorldQueueMDBmessage-driven bean. If you look at the container console window, you should see some output like the following:14:41:20,739 INFO [class org.jboss.as.quickstarts.mdb.HelloWorldQueueMDB] (default-threads - 7) Received Message from queue: This is message 5 14:41:20,739 INFO [class org.jboss.as.quickstarts.mdb.HelloWorldQueueMDB] (default-threads - 5) Received Message from queue: This is message 3 14:41:20,739 INFO [class org.jboss.as.quickstarts.mdb.HelloWorldQueueMDB] (default-threads - 4) Received Message from queue: This is message 2 14:41:20,741 INFO [class org.jboss.as.quickstarts.mdb.HelloWorldQueueMDB] (default-threads - 6) Received Message from queue: This is message 4 14:41:20,742 INFO [class org.jboss.as.quickstarts.mdb.HelloWorldQueueMDB] (default-threads - 3) Received Message from queue: This is message 1
These console messages are written by theHelloWorldQueueMDBmessage-driven bean, thus demonstrating that the messages have successfully propagated from the servlet, through the JBoss A-MQ broker, to the message-driven bean. - To send messages to the
HelloWorldTopicMDBmessage-driven bean, navigate to the following URL:http://localhost:8080/jboss-as-helloworld-mdb/HelloWorldMDBServletClient?topic
When you navigate to the preceding URL, the servlet sends five messages to theHelloWorldTopicMDBmessage-driven bean. If you look at the container console window, you should see some output like the following:14:53:02,464 INFO [class org.jboss.as.quickstarts.mdb.HelloWorldTopicMDB] (default-threads - 9) Received Message from topic: This is message 2 14:53:02,466 INFO [class org.jboss.as.quickstarts.mdb.HelloWorldTopicMDB] (default-threads - 10) Received Message from topic: This is message 3 14:53:02,468 INFO [class org.jboss.as.quickstarts.mdb.HelloWorldTopicMDB] (default-threads - 8) Received Message from topic: This is message 1 14:53:02,471 INFO [class org.jboss.as.quickstarts.mdb.HelloWorldTopicMDB] (default-threads - 11) Received Message from topic: This is message 4 14:53:02,472 INFO [class org.jboss.as.quickstarts.mdb.HelloWorldTopicMDB] (default-threads - 12) Received Message from topic: This is message 5
These console messages are written by theHelloWorldTopicMDBmessage-driven bean, thus demonstrating that the messages have successfully propagated from the servlet, throught the JBoss A-MQ broker, to the message-driven bean.
Legal Notice
Trademark Disclaimer
Legal Notice
Third Party Acknowledgements
- JLine (http://jline.sourceforge.net) jline:jline:jar:1.0License: BSD (LICENSE.txt) - Copyright (c) 2002-2006, Marc Prud'hommeaux
mwp1@cornell.eduAll rights reserved.Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of JLine nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - Stax2 API (http://woodstox.codehaus.org/StAX2) org.codehaus.woodstox:stax2-api:jar:3.1.1License: The BSD License (http://www.opensource.org/licenses/bsd-license.php)Copyright (c) <YEAR>, <OWNER> All rights reserved.Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - jibx-run - JiBX runtime (http://www.jibx.org/main-reactor/jibx-run) org.jibx:jibx-run:bundle:1.2.3License: BSD (http://jibx.sourceforge.net/jibx-license.html) Copyright (c) 2003-2010, Dennis M. Sosnoski.All rights reserved.Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of JiBX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - JavaAssist (http://www.jboss.org/javassist) org.jboss.javassist:com.springsource.javassist:jar:3.9.0.GA:compileLicense: MPL (http://www.mozilla.org/MPL/MPL-1.1.html)
- HAPI-OSGI-Base Module (http://hl7api.sourceforge.net/hapi-osgi-base/) ca.uhn.hapi:hapi-osgi-base:bundle:1.2License: Mozilla Public License 1.1 (http://www.mozilla.org/MPL/MPL-1.1.txt)
