Announcement Announcement Module
Collapse
No announcement yet.
Destination attribute of jms:listener Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Destination attribute of jms:listener

    Code:
    <jms:listener destination="queue" ref="..." />
    In WebSphere, I've seen that @destination should be the name of the physical queue and not the jndi name or the WebSphere assigned name. Is that correct? Why doesn't the JNDI name work?

  • #2
    destination=".." expects a bean reference. You can use Spring's jndi support (either JndiObjectFactoryBean or more concise jee namespace) to provide the Destination as a bean. Or you could actually use destination-name instead and then rely on the JndiDestinationResolver strategy.

    Hope that helps.
    -Mark

    Comment


    • #3
      Ok, I see that the destination resolver being used is DynamicDestinationResolver. So is this intelligent enough to figure out the queue based on the actual physical queue name? Why is that this destination resolver resolves the connection factory via the jndi name but not the queue?
      Also based on your answer, I believe if we use JNDIDestinationResolver, we should be able to use the jndi name of the queue instead of the queue name. Correct?
      Also, could you please tell me what is meant by dynamic destination? Is this app server dependent?
      Last edited by binz84; May 2nd, 2012, 04:46 PM.

      Comment


      • #4
        Yes.. DynamicDestinationResolver uses the JMS API directly (createQueue/createTopic). JndiDestinationResolver allows you to use the JNDI name.

        What I said about bean reference above is true for BeanFactoryDestinationResolver.

        Hope that clarifies.
        -Mark

        Comment


        • #5
          Here is a discrepancy I see:
          Within a jms:listener, the destination name has to be the actual queue name. But for the JMSTemplate, the DefaultDestinationName can be the jndi name of the queue. (Both uses the same DynamicDestinationResolver bean). Is this unexpected?

          Comment


          • #6
            Are you sure the JmsTemplate where you're seeing that behavior does not have a JndiDestinationResolver configured?

            Comment


            • #7
              Oh ya, the jmstemplate has the defaultDestination property referring a bean that has been created via jee:jndi-lookup. Now it makes sense. Looks like the destinationResolver property for jmsTemlate is a redundant config here. Thanks Mark.

              Comment

              Working...
              X