jms-spec
  1. jms-spec
  2. JMS_SPEC-63

Introduce concept of platform default JMS connection factory in Java EE

    Details

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

      Description

      In a Java EE environment a JMS provider is mandatory present and can be used without the user having to configure or setup anything.

      Some implementations (e.g. JBoss AS), provide by default a JMS connection factory for this platform provided JMS provider (java:/ConnectionFactory and java:JmsXA), yet in other implementations (e.g. GlassFish) users have to create a connection factory themselves.

      I would like to propose to formally introduce the concept of a platform default JMS connection factory and make this available under some portable JNDI name (e.g. java:/JmsConnectionFactory). The exact configuration of this factory should be an implementation detail, but the spirit of the specification should be that it must not be purposely crippled and should be principally intended for production use.

      Besides shielding users from having to create a connection factory, an additional benefit might be that other platform JMS facilities that otherwise would need an explicit reference to a connection factory, could default to this standard connection factory.

      E.g. from http://java.net/downloads/jms-spec/JMS2.0Devoxx2011.pdf slide 23:

      @Inject 
      @JMSConnection(lookup="jms/connFactory") 
      @JMSDestination(lookup="jms/inboundQueue") 
      MessageProducer producer;
      

      could become:

      @Inject 
      @JMSDestination(lookup="jms/inboundQueue") 
      MessageProducer producer; // defaults to java:/JmsConnectionFactory
      

      etc.

        Issue Links

          Activity

          Hide
          Nigel Deakin added a comment -

          I think this is a good idea, which I'll raise with the JSR 343 expert group. This might need to be defined in the Java EE platform spec rather than the JMS spec. I'll investigate.

          Show
          Nigel Deakin added a comment - I think this is a good idea, which I'll raise with the JSR 343 expert group. This might need to be defined in the Java EE platform spec rather than the JMS spec. I'll investigate.
          Hide
          Nigel Deakin added a comment -

          I have logged this in the Java EE issue tracker as JAVAEE_SPEC-2

          Show
          Nigel Deakin added a comment - I have logged this in the Java EE issue tracker as JAVAEE_SPEC-2
          Hide
          Nigel Deakin added a comment -

          This has now been included in the Java EE 7 specification. A new section EE 5.19 "Default JMS COnnection Factory" states:

          The Java EE Platform requires that a Java EE Product Provider provide a JMS provider in the operational environment (see Section EE.2.7.8, "Java™ Message Service (JMS)") . The Java EE Product Provider must also provide a preconfigured, JMS ConnectionFactory for use by the application in accessing this JMS provider.

          The Java EE Product Provider must make the default JMS connection factory accessible to the application under the JNDI name java:comp/defaultJMSConnectionFactory.

          The Application Component Provider or Deployer may explicitly bind a JMS ConnectionFactory resource reference to the default connection factory using the lookup element of the Resource annotation or the lookup-name element of the resource-ref deployment descriptor element. For example,

          @Resource(name="myJMSCF", lookup="java:comp/defaultJMSConnectionFactory") 
          ConnectionFactory myJMScf;
          

          In the absence of such a binding for a JMS connection factory resource reference, the reference will map to a JMS connection factory for the product's JMS provider.

          For example, the following will map to a preconfigured connection factory for the product's default JMS provider:

          @Resource(name="myJMSCF")
          ConnectionFactory myJMScf;
          
          Show
          Nigel Deakin added a comment - This has now been included in the Java EE 7 specification. A new section EE 5.19 "Default JMS COnnection Factory" states: The Java EE Platform requires that a Java EE Product Provider provide a JMS provider in the operational environment (see Section EE.2.7.8, "Java™ Message Service (JMS)") . The Java EE Product Provider must also provide a preconfigured, JMS ConnectionFactory for use by the application in accessing this JMS provider. The Java EE Product Provider must make the default JMS connection factory accessible to the application under the JNDI name java:comp/defaultJMSConnectionFactory . The Application Component Provider or Deployer may explicitly bind a JMS ConnectionFactory resource reference to the default connection factory using the lookup element of the Resource annotation or the lookup-name element of the resource-ref deployment descriptor element. For example, @Resource(name="myJMSCF", lookup="java:comp/defaultJMSConnectionFactory") ConnectionFactory myJMScf; In the absence of such a binding for a JMS connection factory resource reference, the reference will map to a JMS connection factory for the product's JMS provider. For example, the following will map to a preconfigured connection factory for the product's default JMS provider: @Resource(name="myJMSCF") ConnectionFactory myJMScf;

            People

            • Assignee:
              Unassigned
              Reporter:
              arjan tijms
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: