Java 如何在 Jboss 6 中配置 JMS?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20851629/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to configure JMS in Jboss 6?
提问by Ami
I newbie to JMS(java Messaging service). I want to run sample JMS application using jboss 6.
我是 JMS(java 消息服务)的新手。我想使用 jboss 6 运行示例 JMS 应用程序。
I have tired searching google and got like this. Those link are refer jboss 7.
我已经厌倦了谷歌搜索,并得到了像这样。这些链接是指 jboss 7。
1.How to configure JMS in jboss 6?
1.如何在jboss 6中配置JMS?
2.Is there Jboss7 have in built-in JMS? or need configure manually?
2.Jboss7有内置JMS吗?还是需要手动配置?
3.sample Application using Jboss 6?
3.使用Jboss 6的示例应用程序?
采纳答案by Ami
Finally i got the link for sample jms application using Jboss 6.x. There are two ways you can configure jms queue in jboss 1.Add message queue details in jboss/server/default/deploy/hornetq/hornetq.jms.xm
最后我得到了使用 Jboss 6.x 的示例 jms 应用程序的链接。在jboss中配置jms队列有两种方式 1.在jboss/server/default/deploy/hornetq/hornetq.jms.xm中添加消息队列详细信息
<queue name="myQueue">
<entry name="/queue/MyQueue"/>
</queue>
2.create xml file in your workspace and add the message queue details
2.在您的工作区中创建xml文件并添加消息队列详细信息
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:hornetq"
xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd" >
<queue name="MyQueue2" >
<entry name="/queue/MyQueue" />
</queue>
</configuration>
Maintain this file under META-INF folder of in your workspace.
在您的工作区的 META-INF 文件夹下维护此文件。
Refer this sample application.
请参阅此示例应用程序。
In this example includes 1.How to configure jms in jboss using hornetq. 2.Sending messages to jms message queue 3.Display messages from jboss server
本例包括1.如何使用hornetq在jboss中配置jms。2.发送消息到jms消息队列 3.显示来自jboss服务器的消息
回答by Jakub Kubrynski
In Jboss 7 (and 6 as well) you have bundled HornetQ server. In Jboss 6 it is located in deploy\hornetq.sar. If you want to add destination you can specify it in hornetq-jms.xml file:
在 Jboss 7(以及 6)中,您捆绑了 HornetQ 服务器。在 Jboss 6 中,它位于 deploy\hornetq.sar。如果你想添加目的地,你可以在 hornetq-jms.xml 文件中指定它:
<topic name="myTopic">
<entry name="/topic/myTopic"/>
</topic>
<queue name="myQueue">
<entry name="/queue/myQueue"/>
</queue>
In Jboss 7 it looks like below:
在 Jboss 7 中,它如下所示:
<subsystem xmlns="urn:jboss:domain:messaging:1.1">
<hornetq-server>
<jms-destinations>
<jms-queue name="myQueue">
<entry name="queue/myqueue"/>
</jms-queue>
<jms-topic name="myTopic">
<entry name="topic/mytopic"/>
</jms-topic>
</jms-destinations>
</hornetq-server>
</subsystem>
You can find more information in HornetQ documentation
您可以在 HornetQ 文档中找到更多信息
回答by user2771655
Also you can put your own xml file name like mysettings-hornetq-jms.xml
. Put it inside the hornetq
folder in the jboss6 > deploy
folder.
你也可以把你自己的 xml 文件名像mysettings-hornetq-jms.xml
. 把它放在hornetq
文件夹中的jboss6 > deploy
文件夹中。
when name the xml use -hornetq-jms.xml
( your name infront )
命名 xml 时使用-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="testQueue">
<entry name="/queue/myQueue"/>
</queue>
</configuration>