Table of Contents
Many applications use the Java Message Service for asynchronous messaging. Geronimo includes a JMS server, and application components can access JMS resources including connection factories, topics, and queues from the JMS server. When mapped as application resources, these JMS objects can be accessed from:
EJBs
Web Applications
Client Applications
Geronimo services (GBeans)
Geronimo plugins
JMS resource groups may be configured at the server level, at the application level, or in the case of an application client, as a part of a single application module. Each of these deployment options works a little differently:
The JMS resource group can be started or stopped using the Geronimo console or deployment tools. Any application or module can declare a dependency on the resource group module, and then use it via resource references, message destination references, etc.
The JMS resource group is deployed as part of an application, and started or stopped when the application is started or stopped. Any module in the same application can use it via resource and message destination references. Other applications or modules can declare a dependency on this application in order to use the included JMS resources, and again use them via references. Note that application-scoped deployments are a convenience feature not a security feature -- other applications can always declare a dependency on the application containing the JMS resource group in order to access the JMS resources.
Application clients cannot access JMS resources running in the server. However, the same configuration syntax can be used to deploy a JMS resource group on the client side as part of the application client deployment. In this case, the JMS resources are visible only to the application client. In this case, the client VM must be able to connect directly to the JMS server (normally, the JMS port used by the Geronimo server).
This chapter covers configuring JMS resource groups in each of these ways. We'll also look at customizing the embedded ActiveMQ JMS server, though that's not normally necessary.
There are two aspects to JMS in Geronimo: the JMS Server itself (also known as the Message Broker), and the connection factories, topics, and queues through which individual application components communicate with the message broker. An ActiveMQ message broker is started by default in Geronimo, and usually does not need to be changed. JMS connection factories and destinations are bundled into JMS Resource Groups which can be individually deployed into Geronimo. Under the covers, JMS resource groups are configured as J2EE Connectors, and the default JMS resource groups connect to the embedded ActiveMQ server, so the J2EE Connector used to deploy JMS connection factories and destinations is known as the ActiveMQ RAR.
With that in mind, there are several steps to deploying JMS resources:
Ensure an ActiveMQ message broker is running in the server (the default module for it is geronimo/activemq-broker/1.1/car).
Write the RAR deployment plan for the JMS resources
Deploy JMS resources using the ActiveMQ RAR
Configure application components to refer to those JMS resources
Write code that accesses JMS resources in JNDI and configures properties such as persistence and transactions before sending or receiving messages.
![]() | Tip |
|---|---|
If you deploy JMS Resource Groups through the Geronimo console, you won't have to worry about the details of the RAR file and deployment plan. The console can only deploy server-wide resource groups, though you can use it to write a plan for an application-scoped or client-scoped resource group. |
When you deploy a server-wide resource group, you'll give the customized deployment descriptor and the ActiveMQ RAR to the deploy tool, and it will deploy the new resource group as it would any other standalone J2EE Connector. When you deploy an application-scoped JMS resource group, you'll include the ActiveMQ RAR in the application EAR like any other application module, and add the customized deployment descriptor to the EAR as well. When you deploy a client-scoped resource group, you'll use a shortcut in the client module's Geronimo-specific deployment descriptor that allows you to configure a J2EE Connector right there, for that module alone. In any of those cases the ActiveMQ RAR is the same and the configuration file format is the same; it's just the method of deployment that's different.