简体   繁体   English

将JMS配置配置到Spring应用程序中意味着什么?

[英]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. 我正在研究Spring框架如何处理JMS,并且在我的学习资料上有以下有关该问题的疑问。

Consider the following JMS configuration defined into a Spring application: 考虑在Spring应用程序中定义的以下JMS配置:

<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?) 现在,我知道通常是从工厂获得JMS连接的 ,所以我认为它正在配置为我提供JMS连接的工厂(是吗?)

But what exactly specify this line?: 但是到底是什么指定了这一行呢:

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

Tnx TNX

That would be a Message-driven Bean-like in the plain Java EE world. 普通的 Java EE世界中,这将类似于消息驱动的Bean。 Have a look here . 在这里看看。 By the way, the attribute is destination="queue.name" ; 顺便说一句,该属性为destination="queue.name" ; there is no such a thing like <jms:listener-destination="order.queue"... 没有像<jms:listener-destination="order.queue"...这样的东西<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) destination:此侦听器的目标名称(换句话说:侦听器将“监听”到的队列;在较新版本的Spring中命名为Destination
  • ref: The bean name of the handler (see next point) ref:处理程序的bean名称(请参阅下一点)
  • method: The name of the handler method to invoke. method:要调用的处理程序方法的名称。 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) 如果ref指向MessageListener或Spring SessionAwareMessageListener ,则可以省略此属性(这就是为什么后两个必须实现onMessage方法的原因,并且按照惯例将其调用)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM