【问题标题】:How to configure JMS in Jboss 6?如何在 Jboss 6 中配置 JMS?
【发布时间】:2013-12-31 04:17:00
【问题描述】:

我是 JMS(java 消息服务)的新手。我想使用 jboss 6 运行示例 JMS 应用程序。

我已经厌倦了在谷歌上搜索并得到了this。这些链接是参考 jboss 7。

1.jboss 6中如何配置JMS?

2.Jboss7有内置的JMS吗?还是需要手动配置?

3.使用 Jboss 6 的示例应用程序?

【问题讨论】:

    标签: java jms jboss6.x


    【解决方案1】:

    在 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>
    

    在 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>
    

    您可以在 HornetQ 文档中找到更多信息

    【讨论】:

    • 感谢 Jakub。我已经配置了 xml 文件。之后我还能做什么?你能解释更多吗?
    • 谢谢。我不知道你是否完整地阅读了问题。我是 jms queue 的新手。所以我期待 jms 配置以及示例应用程序及其工作原理。
    【解决方案2】:

    最后我得到了使用 Jboss 6.x 的示例 jms 应用程序的链接。 有两种方法可以在 jboss 中配置 jms 队列 1.在jboss/server/default/deploy/hornetq/hornetq.jms.xm中添加消息队列详情

    <queue name="myQueue">
      <entry name="/queue/MyQueue"/>
    </queue>
    

    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>
    

    在工作区的 META-INF 文件夹下维护此文件。

    请参阅此示例application

    在这个例子中包括 1.如何使用hornetq在jboss中配置jms。 2.向jms消息队列发送消息 3.显示来自jboss服务器的消息

    【讨论】:

    • 这里与@Jakub K 答案有什么不同?
    【解决方案3】:

    您也可以输入自己的 xml 文件名,例如 mysettings-hornetq-jms.xml。将其放在jboss6 &gt; deploy 文件夹中的hornetq 文件夹中。

    当命名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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-22
      • 2018-12-18
      • 2013-03-15
      • 1970-01-01
      • 1970-01-01
      • 2014-10-05
      • 2013-07-27
      • 1970-01-01
      相关资源
      最近更新 更多