AndreaNobili
AndreaNobili

Reputation: 42957

What means this JMS configuration into a Spring application?

I am studying how Spring framework handle JMS and I have the following doubt related this question founded on my study material.

Consider the following JMS configuration defined into a Spring application:

<jms:listener-container connetionFactory="connectionFactory">
    <jms:listener-destination="order.queue" ref="orderListener" method="order" />
</jms:listener-container>

What exactly does this configuration?

Now I know that a JMS connection is tipically obtained from a factory, so I think that it is configuring the factory that give me my JMS connection (is it right?)

But what exactly specify this line?:

<jms:listener-destination="order.queue" ref="orderListener" method="order" /> 

Tnx

Upvotes: 0

Views: 274

Answers (1)

user4695271
user4695271

Reputation:

That would be a Message-driven Bean-like in the plain Java EE world. Have a look here. By the way, the attribute is destination="queue.name"; there is no such a thing like <jms:listener-destination="order.queue"...

  • destination: The destination name for this listener (in other words: the queue where the listener will "listen" to; named as destination in newer versions of Spring)
  • ref: The bean name of the handler (see next point)
  • method: The name of the handler method to invoke. If the ref points to a MessageListener or Spring SessionAwareMessageListener, this attribute may be omitted (this is why the latter two must implements the onMessage method, and by convention this will be called)

Upvotes: 1

Related Questions