All that is necessary to have an Enterprise Bean perform JMS operations is:
jonas start |
The Message-Oriented Middleware (the JMS provider implementation) is automatically started (or at least accessed) and the JMS-administered objects that will be used by the Enterprise Beans are automatically created and registered in JNDI.
Then, the EJB can be deployed as usual with:
jonas admin -a XX.jar |
If the JOnAS property jonas.services contains the jms service, the JOnAS JMS service will be launched and will eventually try to launch a JMS implementation (for example, the JORAM MOM or the SwiftMQ MOM) through the JMS service in the JOnAS properties file.
For launching the MOM, consider the following possibilities:
Launching the MOM automatically in the JOnAS JVM.
This is done using the default values for the configuration options (that is, keeping the JOnAS property jonas.service.jms.collocated value true in the jonas.properties file (see the jonas.properties file provided in $JONAS_ROOT/conf directory)).
jonas.service.jms.collocated true |
In this case, the MOM will be launched automatically at server launching time (command jonas start).
Note | |
---|---|
To use the JMS resources from a distant host, the hostname property value in the default a3servers.xml configuration file must be changed from localhost to the actual host name. See case 4 (Launching the MOM on another port number) for details on the JORAM configuration. |
Launching the MOM in a separate JVM on the same host.
To launch JORAM MOM with its default options, use the command: JmsServer
For other MOMs, use the proprietary command.
In this case, the JOnAS property jonas.service.jms.collocated must be set to false in the jonas.properties file:
jonas.service.jms.collocated false |
Launching the MOM on another host.
The MOM can be launched on a separate host. In this case, the JOnAS server must be notified that the MOM is running on another host via the JOnAS property jonas.service.jms.url in the jonas.properties file. For JORAM, its value should be the JORAM URL joram://host:port where host is the host name, and port the default JORAM port number, which is: 16010
jonas.service.jms.collocated false jonas.service.jms.url joram://host2:16010 |
For SwiftMQ, the value of the URL is similar to: smqp://host:4001/timeout=10000
Launching the MOM on another port number (for JORAM)
Changing the default JORAM port number requires a JORAM-specific configuration operation (modifying the a3servers.xml configuration file located in the directory where JORAM is explicitly launched). A default a3servers.xml file is provided in the $JONAS_ROOT/conf directory; this a3servers.xml file specifies that the MOM runs on the localhost using the JORAM default port number.
To launch the MOM on another port number, change the args attribute of the service fr.dyade.aaa.mom.ConnectionFactory element in the a3servers.xml file and update the jonas.service.jms.url property in the jonas.properties file.
The default a3servers.xml file is located in $JONAS_ROOT/conf. To change the location of this file, the system property -Dfr.dyade.aaa.agent.A3CONF_DIR="your directory for a3.xml" must be passed.
To learn how to change other MOM configuration settings (distribution, multi-servers, and so on), refer to the JORAM documentation on http://joram.objectweb.org.
Note | ||
---|---|---|
The MOM may be directly launched by the proprietary command. The command for JORAM is:
This command corresponds to the default options used by the JmsServer command. |
The JMS messages are not persistent when launching the MOM with this command. If persistent messages are required, the -DTransaction=NullTransaction option should be replaced with the -DTransaction=ATransaction option. Refer to the JORAM documentation for more details about this command.
With JOnAS, a JMS server can be accessed through a resource adapter that can be deployed.
To deploy such a resource adapter, put the corresponding archive file (*.rar) in JOnAS's rars/autoload directory, declare it at the end of the jonas.properties file, or deploy it manually through the jonasAdmin tool.
Configuring and deploying such adapters is explained in Section 3.7 Configuring JMS Resource Adapters.