<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!--创建连接工厂--> <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL"> <value>tcp://127.0.0.1:61616</value> </property> </bean> <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"> <property name="connectionFactory"> <ref bean="connectionFactory"/> </property> <!-- 设置默认队列 --> <property name="defaultDestination" ref="destinationTopic"></property> <!-- 设置超时时长 --> <property name="receiveTimeout" value="6000"></property> </bean> <!-- 声明ActiveMQ消息目标,目标是一个队列--> <bean id="destinationQueue" class="org.apache.activemq.command.ActiveMQQueue"> <constructor-arg index="0"> <value>HelloWorldQueue</value> </constructor-arg> </bean> <!-- 声明ActiveMQ消息目标,目标是一个主题ActiveMQTopic--> <bean id="destinationTopic" class="org.apache.activemq.command.ActiveMQTopic"> <constructor-arg index="0"> <value>HelloWorldTopic</value> </constructor-arg> </bean> </beans>
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/13699.html