您的位置:首页 > 运维架构 > Apache

使用JMS Connector支持Apache ActiveMQ(基于Opentext Cordys平台)

2014-03-30 12:13 351 查看

介绍

本文描述怎样去配置JMS Connector连接Apache ActiveMQ消息传送系统。

ActiveMQ是一个开源项目,能被安装和容易配置去测试JMS Connector功能。

安装 Apache ActiveMQ

下载最新正式版本,地址为:http://activemq.apache.org。

解压zip文件内容到一个新的文件夹。

(在windows环境中)从bin文件夹中运行activemq.bat 。

创建 JNDI 属性文件

创建一个文件夹命名为activemq-jndi,这个文件夹将要在随后的步骤中被加入到JRE类路径( JRE class path)中,在这个文件夹中创建一个文件命名为 jndi.properties ,文件中内容如下:

java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory

# use the following property to configure the default connector

java.naming.provider.url = vm://localhost

# use the following property to specify the JNDI name the connection factory

# should appear as.

connectionFactoryNames = activemq-cf

# register some queues in JNDI using the form

# queue.[jndiName] = [physicalName]

queue.myqueue = example.myqueue

创建 SOAP处理器

1、创建一个新的JMS Connector SOAP 处理器。

2、在 General tab页中,从 JRE classpath中的ActiveMQ lib文件夹 中添加下列文件。
对于ActiveMQ 5.0
activemq-core-5.0.0.jar
geronimo-jms_1.1_spec-1.0.jar
geronimo-j2ee-management_1.0_spec-1.0.jar
commons-logging-1.1.jar
添加activemq-jndi 文件夹全路径到JRE classpath中(确信Cordys用户有读处理此文件夹和文件的权限)。

对于 ActiveMQ 5.1
apache-activemq-5.5.1\lib\activemq-core-5.5.1.jar
apache-activemq-5.5.1\lib\geronimo-j2ee-management_1.1_spec-1.0.1.jar
apache-activemq-5.5.1\lib\geronimo-jms_1.1_spec-1.1.1.jar
apache-activemq-5.5.1\lib\slf4j-api-1.5.11.jar
apache-activemq-5.5.1\lib\optional\slf4j-log4j12-1.5.11.jar
添加activemq-jndi 文件夹全路径到JRE classpath中(确信Cordys用户有读处理此文件夹和文件的权限)。

对于其它版本,jar文件名称或许有点不同For other versions, jar file names might be a bit different

3、在JMS Connector tab页,添加下列属性:

一个新的目的地管理:
Name: activemq
JMS Vendor: ActiveMQ
Provider URL: tcp://localhost:61616
JNDI Name: activemq-cf

目的地管理器下一个新的队列。
Name: myqueue
JNDI Name: myqueue

注:你也可以通过保存文件到/Cordys/JMSConnector/config 文件夹下的XMLStore加载这个配置,并从连接器配置页导入配置。

4、保存连接器配置并启动Soap处理器。

测试配置

确信ActiveMQ 服务在运行, JMS Connector已经被正确的启动,并且你有在 JMS Connector ISV包的角色。

使用下面SOAP请求写一个消息到队列中:

<sendMessage xmlns="http://schemas.cordys.com/1.0/jms" persistentdelivery="" expiration="">

  <destination>activemq.myqueue</destination>

  <message>

    <root>

        <message>Test Apache ActiveMQ message</message>

    </root>

  </message>

</sendMessage>

你应收到下面SOAP响应:

<sendMessageResponse xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://schemas.cordys.com/1.0/jms" persistentdelivery="" expiration="" >

    <messageid>ID:cnd1033-4337-1184592484240-1:0:2:1:1</messageid>

</sendMessageResponse>

使用下面SOAP请求,从队列里读这个消息:

<getMessage xmlns="http://schemas.cordys.com/1.0/jms" waitformessage="true">

  <destination>activemq.myqueue</destination>

  <messageformat>xmlMessage</messageformat>

  <timeout>10000</timeout>

</getMessage>

你应接收下面SOAP响应:

<getMessageResponse xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://schemas.cordys.com/1.0/jms" waitformessage="true" >

  <message>

    <root>

      <message>Test Apache ActiveMQ message</message>

    </root>

  </message>

  <messageid>ID:cnd1033-4337-1184592484240-1:0:5:1:1</messageid>

  <fromdestination>activemq.myqueue</fromdestination>

</getMessageResponse>

原文:Using JMS Connector with Apache ActiveMQ
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐