4

Out-of-the-box, Wildfly 10 configures a pooled connection factory as part of the JMS subsystem with two entries.

      <pooled-connection-factory name="activemq-ra"
                        transaction="xa"
                        connectors="in-vm"
                        entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory"/>

One might inject a connection factory like so:

@Resource(mappedName = "java:jboss/DefaultJMSConnectionFactory")
private ConnectionFactory connectionFactory;

What is the difference between this and choosing the other entry; java:/JmsXA?

chrisjleu
  • 4,329
  • 7
  • 42
  • 55

1 Answers1

0

There is no difference it's an additionnal JNDI entry to suit JMS 2 spec default ConnectionFactory name : java:comp/DefaultJMSConnectionFactory

You should resolve it using this name.

Since JMS 2.0, a default JMS connection factory is accessible to EE application under the JNDI name java:comp/DefaultJMSConnectionFactory. WildFly messaging subsystem defines a pooled-connection-factory that is used to provide this default connection factory. Any parameter change on this pooled-connection-factory will be take into account by any EE application looking the default JMS provider under the JNDI name java:comp/DefaultJMSConnectionFactory.

See https://docs.jboss.org/author/display/WFLY9/Messaging+configuration

The other one is just a legacy identifier :

The JCA layer intercepts the calls to createConnection() and createSession() and provides a caching layer (amongst other things). So when you call createConnection() or createSession(), then, in most cases it's not really calling the actual JMS implementation to actually create a new JMS connection or JMS session, it's just returning one from it's own internal cache - in other words the JCA layer pools JMS connections and JMS sessions.

In JBoss application server, the "special" JMS connection factory which provides the JCA caching is usually available at java:/JmsXA in jndi.

See https://developer.jboss.org/wiki/ShouldICacheJMSConnectionsAndJMSSessions

Gab
  • 7,869
  • 4
  • 37
  • 68