JBOSS5+ActiveMQ5.7集成
在ActiveMQ官方网站中给出了答案,网站中用到的是
ActiveMQ4.0.1+JBOSS4.0.4+JDK1.5+ANT1.6.2,我们项目中用的是
jboss-5.1.0.GA+JDK1.7+ActiveMQ5.7.0另外用ANT1.8.4做的集成测试。
ActiveMQ和JBOSS集成地址:http://activemq.apache.org/integrating-apache-activemq-with-jboss.html
具体做法:
1. 安装JDK(不说了,too easy)
2. 安装JBOSS(解压就好)
3. 下载ActiveMQ的rar资源组件包【老版本的ActiveMQ在ActiveMQ压缩包中就有,新版本的压缩包中没有需要单独下载】(如何对J2EE的容器组件开发模型了解的都清楚,j2ee中有五个组件,其中有一个就是资源组件,我们要下载的ActiveMQ的rar文件就是一个资源组件):
https://repository.cloudera.com/content/groups/cdh-build/org/apache/activemq/activemq-rar/5.7.0/
4. 解压RAR拷贝到JBOSS的default/deploy中
5. 配置 activemq(1):修改 META-INF/ra.xml
- <?xmlversionxmlversion="1.0"encoding="UTF-8"?>
- <!--
- Licensed to the Apache Software Foundation(ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional informationregarding copyright ownership.
- The ASF licenses this file to You under theApache License, Version 2.0
- (the "License"); you may not usethis file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreedto in writing, software
- distributed under the License isdistributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANYKIND, either express or implied.
- See the License for the specific languagegoverning permissions and
- limitations under the License.
- -->
- <connectorxmlnsconnectorxmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
- http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
- version="1.5">
- <description>ActiveMQ inbound and outbound JMSResourceAdapter</description>
- <display-name>ActiveMQ JMS ResourceAdapter</display-name>
- <vendor-name>activemq.org</vendor-name>
- <eis-type>JMS 1.1</eis-type>
- <resourceadapter-version>1.0</resourceadapter-version>
- <license>
- <description>
- Licensed to the Apache Software Foundation(ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional informationregarding copyright ownership.
- The ASF licenses this file to You under theApache License, Version 2.0
- (the "License"); you may not usethis file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreedto in writing, software
- distributed under the License isdistributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANYKIND, either express or implied.
- See the License for the specific languagegoverning permissions and
- limitations under the License.
- </description>
- <license-required>true</license-required>
- </license>
- <resourceadapter>
- <resourceadapter-class>org.apache.activemq.ra.ActiveMQResourceAdapter</resourceadapter-class>
- <config-property>
- <description>
- The URL to the ActiveMQ serverthat you want this connection to connect to. If using
- an embedded broker, this valueshould be 'vm://localhost'.
- </description>
- <config-property-name>ServerUrl</config-property-name>
- <config-property-type>java.lang.String</config-property-type>
- <!--<config-property-value>tcp://localhost:61616</config-property-value>-->
- <config-property-value>vm://localhost</config-property-value>
- </config-property>
- <config-property>
- <description>The default username that will be used to establish connections to the ActiveMQserver.</description>
- <config-property-name>UserName</config-property-name>
- <config-property-type>java.lang.String</config-property-type>
- <config-property-value>defaultUser</config-property-value>
- </config-property>
- <config-property>
- <description>The defaultpassword that will be used to log the default user into the ActiveMQserver.</description>
- <config-property-name>Password</config-property-name>
- <config-property-type>java.lang.String</config-property-type>
- <config-property-value>defaultPassword</config-property-value>
- </config-property>
- <config-property>
- <description>The client idthat will be set on the connection that is established to the ActiveMQserver.</description>
- <config-property-name>Clientid</config-property-name>
- <config-property-type>java.lang.String</config-property-type>
- </config-property>
- <config-property>
- <description>Boolean to configureif outbound connections should reuse the inbound connection's session forsending messages.</description>
- <config-property-name>UseInboundSession</config-property-name>
- <config-property-type>java.lang.Boolean</config-property-type>
- <config-property-value>false</config-property-value>
- </config-property>
- <!-- NOTE disable the following propertyif you do not wish to deploy an embedded broker -->
- <config-property>
- <description>
- Sets the XML configuration file used toconfigure the embedded ActiveMQ broker via
- Spring if using embedded mode.
- BrokerXmlConfig is the filenamewhich is assumed to be on the classpath unless
- a URL is specified. So a value offoo/bar.xml would be assumed to be on the
- classpath whereasfile:dir/file.xml would use the file system.
- Any valid URL string issupported.
- </description>
- <config-property-name>BrokerXmlConfig</config-property-name>
- <config-property-type>java.lang.String</config-property-type>
- <!--<config-property-value></config-property-value>-->
- <config-property-value>xbean:broker-config.xml</config-property-value>
- <!--
- To use the broker-config.xml fromthe root for the RAR
- To use an external file or urllocation
- <config-property-value>xbean:file:///amq/config/jee/broker-config.xml</config-property-value>
- -->
- </config-property>
- <outbound-resourceadapter>
- <connection-definition>
- <managedconnectionfactory-class>org.apache.activemq.ra.ActiveMQManagedConnectionFactory</managedconnectionfactory-class>
- <connectionfactory-interface>javax.jms.ConnectionFactory</connectionfactory-interface>
- <connectionfactory-impl-class>org.apache.activemq.ra.ActiveMQConnectionFactory</connectionfactory-impl-class>
- <connection-interface>javax.jms.Connection</connection-interface>
- <connection-impl-class>org.apache.activemq.ra.ManagedConnectionProxy</connection-impl-class>
- </connection-definition>
- <connection-definition>
- <managedconnectionfactory-class>org.apache.activemq.ra.ActiveMQManagedConnectionFactory</managedconnectionfactory-class>
- <connectionfactory-interface>javax.jms.QueueConnectionFactory</connectionfactory-interface>
- <connectionfactory-impl-class>org.apache.activemq.ra.ActiveMQConnectionFactory</connectionfactory-impl-class>
- <connection-interface>javax.jms.QueueConnection</connection-interface>
- <connection-impl-class>org.apache.activemq.ra.ManagedConnectionProxy</connection-impl-class>
- </connection-definition>
- <connection-definition>
- <managedconnectionfactory-class>org.apache.activemq.ra.ActiveMQManagedConnectionFactory</managedconnectionfactory-class>
- <connectionfactory-interface>javax.jms.TopicConnectionFactory</connectionfactory-interface>
- <connectionfactory-impl-class>org.apache.activemq.ra.ActiveMQConnectionFactory</connectionfactory-impl-class>
- <connection-interface>javax.jms.TopicConnection</connection-interface>
- <connection-impl-class>org.apache.activemq.ra.ManagedConnectionProxy</connection-impl-class>
- </connection-definition>
- <transaction-support>XATransaction</transaction-support>
- <authentication-mechanism>
- <authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
- <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
- </authentication-mechanism>
- <reauthentication-support>false</reauthentication-support>
- </outbound-resourceadapter>
- <inbound-resourceadapter>
- <messageadapter>
- <messagelistener>
- <messagelistener-type>javax.jms.MessageListener</messagelistener-type>
- <activationspec>
- <activationspec-class>org.apache.activemq.ra.ActiveMQActivationSpec</activationspec-class>
- <required-config-property>
- <config-property-name>destination</config-property-name>
- </required-config-property>
- <required-config-property>
- <config-property-name>destinationType</config-property-name>
- </required-config-property>
- </activationspec>
- </messagelistener>
- </messageadapter>
- </inbound-resourceadapter>
- <adminobject>
- <adminobject-interface>javax.jms.Queue</adminobject-interface>
- <adminobject-class>org.apache.activemq.command.ActiveMQQueue</adminobject-class>
- <config-property>
- <config-property-name>PhysicalName</config-property-name>
- <config-property-type>java.lang.String</config-property-type>
- </config-property>
- </adminobject>
- <adminobject>
- <adminobject-interface>javax.jms.Topic</adminobject-interface>
- <adminobject-class>org.apache.activemq.command.ActiveMQTopic</adminobject-class>
- <config-property>
- <config-property-name>PhysicalName</config-property-name>
- <config-property-type>java.lang.String</config-property-type>
- </config-property>
- </adminobject>
- </resourceadapter>
- </connector>
6. 配置 activemq (2):修改 broker-config.xml 文件
- <?xmlversionxmlversion="1.0"encoding="UTF-8"?>
- <!--
- Licensed to the Apache Software Foundation(ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional informationregarding copyright ownership.
- The ASF licenses this file to You under theApache License, Version 2.0
- (the "License"); you may not usethis file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreedto in writing, software
- distributed under the License isdistributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANYKIND, either express or implied.
- See the License for the specific languagegoverning permissions and
- limitations under the License.
- -->
- <!--START SNIPPET: xbean -->
- <beans
- xmlns="http://www.springframework.org/schema/beans"
- xmlns:amq="http://activemq.apache.org/schema/core"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://activemq.apache.org/schema/corehttp://activemq.apache.org/schema/core/activemq-core.xsd">
- <!-- shutdown hook is disabled as RAR classloader may be gone at shutdown-->
- <brokerxmlnsbrokerxmlns="http://activemq.apache.org/schema/core"useJmx="true"useShutdownHook="false"brokerName="bruce.broker1">
- <managementContext>
- <!-- use appserver provided contextinstead of creating one,
- for jboss use:-Djboss.platform.mbeanserver -->
- <managementContextcreateConnectormanagementContextcreateConnector="false"/>
- </managementContext>
- <persistenceAdapter>
- <kahaDBdirectorykahaDBdirectory="activemq-data/kahadb"/>
- <!--<jdbcPersistenceAdapterdataSource="#oracle-ds"/>-->
- </persistenceAdapter>
- <transportConnectors>
- <transportConnectornametransportConnectorname="bruce.broker1"uri="tcp://localhost:61616"/>
- </transportConnectors>
- </broker>
- </beans>
7. 配置 jboss5,使得jboss5启动的时候能够启动activemq
新建 /default/deploy/activemq-ds.xml 文件,内容如下:
- <?xmlversionxmlversion="1.0"encoding="UTF-8"?>
- <!DOCTYPEconnection-factories
- PUBLIC "-//JBoss//DTD JBOSS JCA Config5.0//EN"
- "http://www.jboss.org/j2ee/dtd/jboss-ds_5_0.dtd">
- <connection-factories>
- <tx-connection-factory>
- <jndi-name>activemq/QueueConnectionFactory</jndi-name>
- <xa-transaction/>
- <track-connection-by-tx/>
- <rar-name>activemq-ra-5.7.0.rar</rar-name>
- <connection-definition>javax.jms.QueueConnectionFactory</connection-definition>
- <ServerUrl>vm://localhost</ServerUrl>
- <!--
- <UserName>sa</UserName>
- <Password></Password>
- -->
- <min-pool-size>1</min-pool-size>
- <max-pool-size>200</max-pool-size>
- <blocking-timeout-millis>30000</blocking-timeout-millis>
- <idle-timeout-minutes>3</idle-timeout-minutes>
- </tx-connection-factory>
- <tx-connection-factory>
- <jndi-name>activemq/TopicConnectionFactory</jndi-name>
- <xa-transaction/>
- <track-connection-by-tx/>
- <rar-name>activemq-ra-5.7.0.rar</rar-name>
- <connection-definition>javax.jms.TopicConnectionFactory</connection-definition>
- <ServerUrl>vm://localhost</ServerUrl>
- <!--
- <UserName>sa</UserName>
- <Password></Password>
- -->
- <min-pool-size>1</min-pool-size>
- <max-pool-size>200</max-pool-size>
- <blocking-timeout-millis>30000</blocking-timeout-millis>
- <idle-timeout-minutes>3</idle-timeout-minutes>
- </tx-connection-factory>
- <mbeancodembeancode="org.jboss.resource.deployment.AdminObject"name="activemq.queue:name=outboundQueue">
- <attributenameattributename="JNDIName">activemq/queue/outbound</attribute>
- <dependsoptional-attribute-namedependsoptional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra-5.7.0.rar'</depends>
- <attributenameattributename="Type">javax.jms.Queue</attribute>
- <attributenameattributename="Properties">PhysicalName=queue.outbound</attribute>
- </mbean>
- <mbeancodembeancode="org.jboss.resource.deployment.AdminObject"name="activemq.topic:name=inboundTopic">
- <attributenameattributename="JNDIName">activemq/topic/inbound</attribute>
- <dependsoptional-attribute-namedependsoptional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra-5.7.0.rar'</depends>
- <attributenameattributename="Type">javax.jms.Topic</attribute>
- <attributenameattributename="Properties">PhysicalName=topic.inbound</attribute>
- </mbean>
- </connection-factories>
8. 启动 jboss5
9. 验证集成成功与否
a) 安装ANT
b) 配置ANT环境变量
c) 启动JBOSS
d) 打开一个命令窗口,输入
cd /apache-activemq-5.3.1/example
ant consumer
e) 打开另外一个命令窗口,输入:
cd /apache-activemq-5.3.1/example
ant consumer
10. 运行成功
JBOSS5+ActiveMQ5.7集成相关推荐
- springboot的细节挖掘(ActiveMq集成)
官网下载地址: http://activemq.apache.org/?utm_source=csdn_toolbar 下载的时候区别:ActiveMQ 5 "Classic"和A ...
- Nignx集成fastDFS后访问Nginx一直在加载中解决
问题描述: Nginx集成fastDFS后,访问Nginx一直在加载中,得不到页面.查看Nginx的错误日志: 可以看到是fastdfs.conf的配置错误,tracker的ip没有修改: fastd ...
- Hexo集成Algolia实现搜索功能
2年前搭建的hexo博客好久没有维护了,一看 hexo 以及先前使用 butterfly 主题已经更新好几个版本了,看介绍在速度性能上有了很大的提高,于是打算给 hexo 升个级,整理整理翻翻新.通过 ...
- 将TVM集成到PyTorch
将TVM集成到PyTorch 随着TVM不断展示出对深度学习执行效率的改进,很明显PyTorch将从直接利用编译器堆栈中受益.PyTorch的主要宗旨是提供无缝且强大的集成,而这不会妨碍用户.PyTo ...
- 将TVM集成到PyTorch上
将TVM集成到PyTorch上 随着TVM不断展示出对深度学习执行效率的改进,很明显PyTorch将从直接利用编译器堆栈中受益.PyTorch的主要宗旨是提供无缝且强大的集成,而这不会妨碍用户.为此, ...
- Vitis-AI集成
Vitis-AI集成 Vitis-AI是Xilinx的开发堆栈,用于在Xilinx平台(包括边端设备和Alveo卡)上进行硬件加速的AI推理.它由优化的IP,工具,库,模型和示例设计组成.设计时考虑到 ...
- 中继TensorRT集成
中继TensorRT集成 介绍 NVIDIA TensorRT是用于优化深度学习推理的库.这种集成将使尽可能多的算子从Relay转移到TensorRT,从而无需调整调度,即可在NVIDIA GPU上提 ...
- 如何在TVM上集成Codegen(下)
如何在TVM上集成Codegen(下) Bring DNNL to TVM: JSON Codegen/Runtime 现在实现将Relay,序列化为JSON表示的DNNL codegen,然后实现D ...
- 如何在TVM上集成Codegen(上)
如何在TVM上集成Codegen(上) 许多常用的深度学习内核,或者提供DNNL或TensorRT等框架和图形引擎,让用户以某种方式描述模型,从而获得高性能.此外,新兴的深度学习加速器也有自己的编译器 ...
最新文章
- Vue.js 源码分析(二十三) 指令篇 v-show指令详解
- unity android eclipse,[转]Android笔记:Eclipse嵌入Unity3D开发的3D场景
- 【Python爬虫学习笔记6】JSON文件存储
- [LintCode] Wildcard Matching
- (JAVA学习笔记) 关于i++和++i的区别
- TensorFlow和ML前5名的课程
- 放弃Eclipse Juno
- 【Matplotlib】【Python】如何使用matplotlib颜色映射
- python函数执行顺序_python下for循环接if判断的函数执行顺序
- crfpp python
- iOS开发之开源项目链接
- jmeter无法启动的解决办法
- 数据AES加密安全传输之后台JAVA加密解密
- php+美图秀秀,美图秀秀web开放平台--PHP流式上传和表单上传示例分享
- UG NX 12 内部草图和外部草图的区别
- 摄氏度符号英文计算机语言,温度表示-摄氏度怎样用英文表示温度?给几个例子,好吗? 爱问知识人...
- android studio实现动画,android studio上的基本动画实现(第一篇)
- 正规蓝牙耳机一般多少钱?音质好又便宜的蓝牙耳机
- 感动,我终于学会了用Java对数组求和
- 创建多线程有几种方法?如何创建线程?