spring-mvc-mq.xml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:mvc="http://www.springframework.org/schema/mvc"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xmlns:p="http://www.springframework.org/schema/p"
  6. xmlns:context="http://www.springframework.org/schema/context"
  7. xmlns:jms="http://www.springframework.org/schema/jms"
  8. xmlns:amq="http://activemq.apache.org/schema/core"
  9. xsi:schemaLocation="http://www.springframework.org/schema/beans
  10. http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  11. http://www.springframework.org/schema/context
  12. http://www.springframework.org/schema/context/spring-context-3.0.xsd
  13. http://www.springframework.org/schema/mvc
  14. http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
  15. http://www.springframework.org/schema/jms
  16. http://www.springframework.org/schema/jms/spring-jms-4.0.xsd
  17. http://activemq.apache.org/schema/core
  18. http://activemq.apache.org/schema/core/activemq-core-5.1.0.xsd">
  19. <!-- 连接 activemq-->
  20. <!--<amq:connectionFactory id="amqConnectionFactory" brokerURL="${activemq_url}" userName="${activemq_username}" password="${activemq_password}"/>-->
  21. <!-- 这里可以采用连接池的方式连接PooledConnectionFactoryBean -->
  22. <!-- <bean id="mqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">-->
  23. <!-- <property name="brokerURL" value="${activemq_url}"/>-->
  24. <!-- <property name="userName" value="${activemq_username}"/>-->
  25. <!-- <property name="password" value="${activemq_password}"/>-->
  26. <!-- &lt;!&ndash; 是否异步发送 &ndash;&gt;-->
  27. <!-- <property name="useAsyncSend" value="true"/>-->
  28. <!-- </bean>-->
  29. <!-- &lt;!&ndash; 定义消息队列topic类型,queue的方式差不多 &ndash;&gt;-->
  30. <!-- <bean id="topic" class="org.apache.activemq.command.ActiveMQTopic">-->
  31. <!-- &lt;!&ndash; 定义名称 &ndash;&gt;-->
  32. <!-- <constructor-arg index="0" value="sendMessage"/>-->
  33. <!-- </bean>-->
  34. <!-- &lt;!&ndash; 配置JMS模板(topic),Spring提供的JMS工具类,它发送、接收消息。 &ndash;&gt;-->
  35. <!-- <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">-->
  36. <!-- <property name="connectionFactory" ref="mqConnectionFactory"/>-->
  37. <!-- <property name="defaultDestination" ref="topic"/>-->
  38. <!-- &lt;!&ndash; 非pub/sub模型(发布/订阅),true为topic,false为queue &ndash;&gt;-->
  39. <!-- <property name="pubSubDomain" value="true"/>-->
  40. <!-- </bean>-->
  41. <!-- <bean id="sendMessageListener" class="cn.com.lzt.message.mq.SendMessageListener"/>-->
  42. <!-- &lt;!&ndash; 监听方式,这种方式更实用,可以一直监听消息 &ndash;&gt;-->
  43. <!-- <bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">-->
  44. <!-- <property name="connectionFactory" ref="mqConnectionFactory"/>-->
  45. <!-- &lt;!&ndash; 注册activemq名称 &ndash;&gt;-->
  46. <!-- <property name="destination" ref="topic"/>-->
  47. <!-- <property name="messageListener" ref="sendMessageListener"/>-->
  48. <!-- </bean>-->
  49. <!--<jms:listener-container destination-type="topic" container-type="default" connection-factory="mqConnectionFactory" acknowledge="auto">
  50. <jms:listener destination="topic" ref="sendMessageListener"/>
  51. </jms:listener-container>-->
  52. </beans>