Applications using messaging require some JMS-administered objects: connection factories and destinations. These objects are created via the proprietary administration interface (not standardized) of the JMS provider. For simple cases, it is possible to have either the jms service, or the JMS resource adapter, performing administration operations during startup.
As provided, the default JMS service and JORAM adapter configurations automatically create six connection factories and two destination objects.
The six connection factories automatically created are described in the following table:
JNDI name | JMS type | Usage |
CF | ConnectionFactory | To be used by an application component to create a connection. |
QCF | QueueConnectionFactory | To be used by an application component to create a QueueConnection. |
TCF | TopicConnectionFactory | To be used by an application component to create a TopicConnection. |
JCF | ConnectionFactory | To be used by any other Java component (for instance a client) to create a connection. |
JQCF | QueueConnectionFactory | To be used by any other Java component (for instance a client) to create a QueueConnection. |
JTCF | TopicConnectionFactory | To be used by any other Java component (for instance a client) to create a TopicConnection. |
The CF, QCF and TCF connection factories are managed connection factories. The application components should use only managed connection factories to allow JOnAS to manage the JMS resources created via these connection factories (the JMS sessions). In contrast, JCF, JQCF and JTCF are non-managed connection factories. They are used by Java components implementing a JMS client behavior, but running outside the application server.
The two destinations automatically created are described in the following table:
JNDI name | JMS type | Usage |
sampleQueue | Queue | Can be equally used by an EJB component or a Java component. |
sampleTopic | Topic | Can be equally used by an EJB component or a Java component. |
To use the JMS service in the default configuration, all that is necessary is requiring the use of the JMS service in the jonas.properties file:
jonas.services security,jtm,dbm,jms,ejb |
JOnAS will not create additional connection factories when using the default configuration. However, JOnAS can create requested destination objects at server launching time, if specified in the jonas.properties file. To do this, specify the JNDI names of the Topic and Queue destination objects to be created in a jonas.service.jms.topics and jonas.service.jms.queues property respectively, as follows:
// JOnAS server creates 2 topic destinations (t1,t2) jonas.service.jms.topics t1,t2 // JOnAS server creates 1 queue destination (myQueue) jonas.service.jms.queuesmyQueue |
It is recommended that programmers use resource references and resource environment references to access the connection factories and destination objects created by JOnAS, as presented in Section 26.2 Writing JMS Operations Within an Application Component.
Starting with JOnAS release 4.1, it is recommended that you deploy a JMS resource adapter instead of using the jms service. How to do this is explained in Section 3.7 Configuring JMS Resource Adapters.