本文描述怎样去配置JMS Connector连接Apache ActiveMQ消息传送系统。
ActiveMQ是一个开源项目,能被安装和容易配置去测试JMS Connector功能。
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
对于其它版本,jar文件名称或许有点不同For other versions, jar file names might be a bit different
3、在JMS Connector tab页,添加下列属性:
注:你也可以通过保存文件到/Cordys/JMSConnector/config 文件夹下的XMLStore加载这个配置,并从连接器配置页导入配置。
4、保存连接器配置并启动Soap处理器。
使用下面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