1. jms-spec
  2. JMS_SPEC-55

Define a standard way to configure the connection factory used by a JMS MDB to consume messages


    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 2.0FD, 2.0
    • Labels:


      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

        Issue Links



            • Assignee:
              Nigel Deakin
              Nigel Deakin
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: