26.4. JMS Administration

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 nameJMS typeUsage
CFConnectionFactoryTo be used by an application component to create a connection.
QCFQueueConnectionFactoryTo be used by an application component to create a QueueConnection.
TCFTopicConnectionFactoryTo be used by an application component to create a TopicConnection.
JCFConnectionFactoryTo be used by any other Java component (for instance a client) to create a connection.
JQCFQueueConnectionFactoryTo be used by any other Java component (for instance a client) to create a QueueConnection.
JTCFTopicConnectionFactoryTo 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 nameJMS typeUsage
sampleQueueQueueCan be equally used by an EJB component or a Java component.
sampleTopicTopicCan be equally used by an EJB component or a Java component.

26.4.1. JMS Service Administration

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.

26.4.2. JMS Resource Adapter Configuration

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.