[JMS_SPEC-55] Define a standard way to configure the connection factory used by a JMS MDB to consume messages Created: 07/Nov/11  Updated: 20/Mar/13  Resolved: 07/Feb/13

Status: Resolved
Project: jms-spec
Component/s: None
Affects Version/s: 1.1
Fix Version/s: 2.0FD, 2.0

Type: Improvement Priority: Major
Reporter: Nigel Deakin Assignee: Nigel Deakin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
depends on CONNECTOR_SPEC-4 Clarify whether the ResourceAdapter.e... Resolved
blocks MQ-250 Implement JMSRA activation properties... Closed
is related to JMS_SPEC-54 Define a standard way to configure th... Resolved
Tags: jms20-jsr345, pd20-added


This is a request for the EJB specification to define a standard way to configure the connection factory used by a MDB to consume messages.

Currently there is no standard way to do this, and vendors differ in the way in which connection information is specified in a MDB. Some vendors support an activation property connectionFactoryJndiName but this is not defined in the EJB 3.1 (or the JCA 1.6) specifications and support for it is not universal. In fact some vendors expect connection information to be specified directly using non-standard activation properties rather than via a connection factory.

This limits the portability of applications between different JMS providers, resource adapters and application servers. It will also hinder the automatic provisioning of JMS resources in a PaaS environment which is a goal of Java EE 7.

Two alternatives are proposed:

1. Define a mandatory activation property connectionFactoryJndiName

This would make it mandatory for application servers to support the activation property connectionFactoryJndiName. This would essentially standardise what some vendors support already.

This could be specified in ejb-jar.xml as follows:


...or using annotation as follows:

    activationConfig = {
            propertyName="connectionFactoryJndiName", propertyValue="jms/connectionFactory")
public class MyMDB implements MessageListener {

2. Define a new element under the <message-driven> element and a corresponding annotation

This option would propose that the <message-driven> element in ejb-jar.xml be extended to define an addition sub-element which can be used to specify the JNDI name of the connection factory used by a JMS message-driven bean to consume messages. A suggested element name is <connection-factory-jndi-name>:


To provide an equivalent annotation, a new attribute would need to be added to the @MessageDriven annotation. A suggested name is connectionFactoryJndiName:

public class MyMDB implements MessageListener {

It might be asked why this needs to be defined by a new subelement of <message-driven> and a new attribute of @MessageDriven rather than by a new standard activation configuration property. Possible answers are:

  • this is needed for consistency with the existing <message-destination-link> and the proposed <message-destination-jndi-name> subelements of <message-driven>. (See JMS_SPEC-54).
  • the connection factory is such an important property of a JMS MDB that it deserves explicit support in the ejb-jar.xml schema and by the compiler, rather than being relegated to being just an activation property.


In brief, the options are:

1) New mandatory activation property connectionFactoryJndiName
2) New element <connection-factory-jndi-name> and corresponding annotation @MessageDriven(connectionFactoryJndiName=...
3) Both 1) and 2)
4) Neither

Comment by Nigel Deakin [ 05/Dec/12 ]

The current proposal is to define a standard activation property connectionFactoryLookup.

However this is only possible if the connector spec can guarantee that the resource adapter will be able to perform the lookup in the endpointActivation call. I have logged CONNECTOR_SPEC-4 to request clarification .

Comment by Nigel Deakin [ 07/Feb/13 ]

The JMS 2.0 and EJB 3.2 specifications now define a activation property connectionFactoryLookup. This is defined as follows (JMS 2.0 section 13.1 "MDB activation properties"):

Activation property Description
connectionFactoryLookup This property may be used to specify the lookup name of an administratively-defined javax.jms.ConnectionFactory, javax.jms.QueueConnectionFactory or javax.jms.TopicConnectionFactory object that will be used to connect to the JMS provider from which the endpoint (message-driven bean) is to receive messages.

This issue is now incorporated in the JMS 2.0 spec and can be marked as resolved.

Generated at Wed Oct 26 15:51:50 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.