The name of the destination (specified by <destination-name>) is global to the application server.
The topics can be look up only by their respective applications but underneath, all the topics are managed by a single HornetQ server. The name of the topics must be unique to be properly identified by HornetQ.
Note that this <destination-name> element is optional and if you don't specify it, a unique name is built (using the application/module/component names + the destination<name> element).
Thanks for your answer.
It seems that I misunderstood the meaning of the "jms-destination" element. I thought I could use it to define in the deployment descriptor the name of the topic or queue to which the messages will be sent by the application. If I want two separate applications to communicate via a shared queue, how can I make sure both actually use the same? If I omit the "destiation-name" then both applications will create their own destinations, which is not what I need.
In my case the situation is even worse because I do not use the embedded HornetQ broker, but an external ActiveMQ which is connected via an appropriate resource adapter. The enterprise application (inside WildFly) should communicate with an external application using JMS, so it is crucial that the topic name is well defined.
Is there any best practice how to solve this?
PS: Where can I find a specification for the "jms-destination" element?
1 of 1 people found this helpful
The jms-destination element is specified in the Java EE7 specification (https://jcp.org/aboutJava/communityprocess/final/jsr342/index.html)
If you want to use a global queue that is shared between 2 applications, I'd advise to create the queue directly in ActiveMQ without using the Java EE7 destination definitions.
Alternatively, you could define the queue in one application in the java:global/ namespace. It will then be available for the other applications (that all have access to the java:global/ namespace).
However if you ever undeploy the application that defines the queue, the JNDI entry will be removed and no application will be able to look it up.
Thanks for the link!
So the jms-destination element does actually define a destination and is not used (as I thought) to reference an existing destination. Is this correct?
When I create the queue in ActiveMQ, how do I tell the application which queue should be used? Or should I administratively add a global JNDI entry that references that destination and reference this JNDI entry in the deployment descriptor using "resource-env-ref" or "message-destination-ref" elements?