簡體   English   中英

如何在Jboss 6中配置JMS?

[英]How to configure JMS in Jboss 6?

我是JMS的新手(java Messaging服務)。 我想使用jboss 6運行示例JMS應用程序。

我已經厭倦了谷歌搜索,並得到了像這樣 這些鏈接是指jboss 7。

1.如何在jboss 6中配置JMS?

2. Jboss7有內置JMS嗎? 或需要手動配置?

3.使用Jboss 6的應用程序?

在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文檔中找到更多信息

最后,我使用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文件夾下。

請參閱此示例應用程序

在這個例子中包括1.如何使用hornetq在jboss中配置jms。 2.將消息發送到jms消息隊列3.顯示來自jboss服務器的消息

您也可以將自己的xml文件名設置為mysettings-hornetq-jms.xml 將它放在jboss6 > deploy文件夾中的hornetq文件夾中。

當命名xml使用-hornetq-jms.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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM