JNDI name format of JMS queue in wildfly10

863 views Asked by At

Hi I am migrating to wildfly 10 from JBoss_6.1.0_final.

In JBoss for Queue name the format is like

<queue name="TEST_QUEUE">
  <entry name="/queue/TEST_QUEUE"/>
</queue>

and in MDB annotation is

@ActivationConfigProperty(propertyName = "destination",
                propertyValue = "queue/TEST_QUEUE")

Now in wildfly its like below. reference link

<jms-queue name="TEST_QUEUE" entries="jms/queue/TEST_QUEUE java:jboss/exported/jms/queue/TEST_QUEUE"/>

with activationproperty

@ActivationConfigProperty(propertyName = "destination",
                        propertyValue = "jms/queue/TEST_QUEUE")

In wildfly I have tried by removing the jms/ from queue name and from annotation, its working fine in wildfly with same queue name , like

<jms-queue name="TEST_QUEUE" entries="queue/TEST_QUEUE java:jboss/exported/queue/TEST_QUEUE"/>

Now my question is, Is JMS/ in queue name added purposefully.

it is good practice to write queue name without prefix jms/

1

There are 1 answers

0
wargre On

From the JEE JSR part EE.5.7.1.2 Programming Interfaces for Resource Manager Connection Factory References

This specification recommends, but does not require, that all resource manager connection factory references be organized in the subcontexts of the application component’s environment, using a different subcontext for each resource manager type. For example, all JDBC™ DataSource references should be declared in the java:comp/env/jdbc subcontext, all JMS connection factories in the java:comp/env/jms subcontext, all JavaMail connection factories in the java:comp/env/mail subcontext, and all URL connection factories in the java:comp/env/url subcontext. Note that resource manager connection factory references declared via annotations will not, by default, appear in any subcontext

the jms subcontext is not mandatory. It is just a best practice.

Servers can or not follow this pattern. JBoss was not following this, wildfly is, but ultimately, it is YOUR decision to do what you want. But this is a really good practice to follow as it is cleaner for everybody.