用@Depends注释StatelessBean到HornetQ-JMS队列 [英] Annotate StatelessBean with @Depends to HornetQ-JMS Queue
问题描述
我在文件中有一个简单的JMS-Queue定义 my-hornetq-jms.xml
:
I have a simple definition of a JMS-Queue in the file my-hornetq-jms.xml
:
<configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
<queue name="my.test.queue">
<entry name="/queue/myTest"/>
</queue>
</configuration>
队列已正确激活,现在我想在我的中添加依赖项@Stateless
Bean。这个问题类似于当我的webapp在JBOSS 6.0中启动时,如何确保大黄蜂队列在那里?,但我想要使用注释定义依赖项。我试过这个(以几种排列方式),但找不到正确的方法:
The queue is activated correctly and now I want to add a dependency in my @Stateless
Bean. This question is similar to How can I ensure that the hornet queues are there when my webapp starts in JBOSS 6.0?, but I want to define the dependency with an annotation. I tried this (in several permutations), but didn't find the right way:
@Depends(value="org.hornetq:module=JMS,type=Queue,name=my.test.queue")
我总是得到这样的错误:
I always get errors like this:
Dependency "<UNKNOWN jboss.j2ee:jar=my.war,name=MyBean,service=EJB3>"
(should be in state "Installed", but is actually in state "** UNRESOLVED Demands
'org.hornetq:module=JMS,name=my.test.queue,type=Queue' **")
BTW:在JBoss-5中我定义如下: @Depends(value =jboss.messaging.destination:service = Queue,name = my.test.queue)
BTW: In JBoss-5 I have defined it like this: @Depends(value = "jboss.messaging.destination:service=Queue,name=my.test.queue")
推荐答案
上述错误的发生是因为我输入了错误的 @Depends
:
The errors described above occurred because I imported the wrong @Depends
:
import org.jboss.ejb3.annotation.Depends; //WRONG
import org.jboss.beans.metadata.api.annotations.Depends; //CORRECT
这篇关于用@Depends注释StatelessBean到HornetQ-JMS队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!