activeMQ
This commit is contained in:
68
src/main/resources/ActiveMQ.xml
Normal file
68
src/main/resources/ActiveMQ.xml
Normal file
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:amq="http://activemq.apache.org/schema/core"
|
||||
xmlns:jms="http://www.springframework.org/schema/jms"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-4.0.xsd
|
||||
http://www.springframework.org/schema/jms
|
||||
http://www.springframework.org/schema/jms/spring-jms-4.0.xsd
|
||||
http://activemq.apache.org/schema/core
|
||||
http://activemq.apache.org/schema/core/activemq-core-5.8.0.xsd">
|
||||
|
||||
<!-- ActiveMQ 连接工厂 -->
|
||||
<!-- 真正可以产生Connection的ConnectionFactory,由对应的 JMS服务厂商提供-->
|
||||
<!-- 如果连接网络:tcp://ip:61616;未连接网络:tcp://localhost:61616 以及用户名,密码-->
|
||||
<amq:connectionFactory id="amqConnectionFactory"
|
||||
brokerURL="tcp://192.168.1.251:61616" userName="admin" password="admin" />
|
||||
|
||||
<!-- Spring Caching连接工厂 -->
|
||||
<!-- Spring用于管理真正的ConnectionFactory的ConnectionFactory -->
|
||||
<bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
|
||||
<!-- 目标ConnectionFactory对应真实的可以产生JMS Connection的ConnectionFactory -->
|
||||
<property name="targetConnectionFactory" ref="amqConnectionFactory"></property>
|
||||
<!-- 同上,同理 -->
|
||||
<!-- <constructor-arg ref="amqConnectionFactory" /> -->
|
||||
<!-- Session缓存数量 -->
|
||||
<property name="sessionCacheSize" value="100" />
|
||||
</bean>
|
||||
|
||||
<!-- Spring JmsTemplate 的消息生产者 start-->
|
||||
|
||||
<!-- 定义JmsTemplate的Queue类型 -->
|
||||
<bean id="jmsQueueTemplate" class="org.springframework.jms.core.JmsTemplate">
|
||||
<!-- 这个connectionFactory对应的是我们定义的Spring提供的那个ConnectionFactory对象 -->
|
||||
<constructor-arg ref="connectionFactory" />
|
||||
<!-- 非pub/sub模型(发布/订阅),即队列模式 -->
|
||||
<property name="pubSubDomain" value="false" />
|
||||
</bean>
|
||||
|
||||
<!-- 定义JmsTemplate的Topic类型 -->
|
||||
<bean id="jmsTopicTemplate" class="org.springframework.jms.core.JmsTemplate">
|
||||
<!-- 这个connectionFactory对应的是我们定义的Spring提供的那个ConnectionFactory对象 -->
|
||||
<constructor-arg ref="connectionFactory" />
|
||||
<!-- pub/sub模型(发布/订阅) -->
|
||||
<property name="pubSubDomain" value="true" />
|
||||
</bean>
|
||||
|
||||
<!--Spring JmsTemplate 的消息生产者 end-->
|
||||
|
||||
|
||||
<!-- 消息消费者 start-->
|
||||
|
||||
<!-- 定义Queue监听器 -->
|
||||
<jms:listener-container destination-type="queue" container-type="default" connection-factory="connectionFactory" acknowledge="auto">
|
||||
<jms:listener destination="test.queue" ref="queueReceiver1"/>
|
||||
<jms:listener destination="test.queue" ref="queueReceiver2"/>
|
||||
</jms:listener-container>
|
||||
|
||||
<!-- 定义Topic监听器 -->
|
||||
<jms:listener-container destination-type="topic" container-type="default" connection-factory="connectionFactory" acknowledge="auto">
|
||||
<jms:listener destination="test.topic" ref="topicReceiver1"/>
|
||||
<jms:listener destination="test.topic" ref="topicReceiver2"/>
|
||||
</jms:listener-container>
|
||||
|
||||
<!-- 消息消费者 end -->
|
||||
</beans>
|
||||
25
src/main/resources/applicationContext.xml
Normal file
25
src/main/resources/applicationContext.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- 查找最新的schemaLocation 访问 http://www.springframework.org/schema/ -->
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:amq="http://activemq.apache.org/schema/core"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-4.0.xsd
|
||||
http://activemq.apache.org/schema/core
|
||||
http://activemq.apache.org/schema/core/activemq-core-5.9.0.xsd">
|
||||
|
||||
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>
|
||||
|
||||
<!-- 配置扫描路径 -->
|
||||
<context:component-scan base-package="osc.git.eh3.springamq">
|
||||
<!-- 只扫描Service,也可以添加Repostory,但是要把Controller排除在外,Controller由spring-mvc.xml去加载 -->
|
||||
<!-- <context:include-filter type="annotation" expression="org.springframework.stereotype.Service" /> -->
|
||||
<!-- <context:include-filter type="annotation" expression="org.springframework.stereotype.Repository" /> -->
|
||||
<!-- <context:include-filter type="annotation" expression="org.springframework.stereotype.Component" /> -->
|
||||
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
|
||||
</context:component-scan>
|
||||
|
||||
</beans>
|
||||
@@ -23,7 +23,7 @@
|
||||
<javaClientGenerator type="XMLMAPPER" targetPackage="com.pxene.dsp.archer.dao" targetProject="src/main/java">
|
||||
<property name="enableSubPackages" value="true"/>
|
||||
</javaClientGenerator>
|
||||
<table tableName="dsp_t_ad_group_apptarget_filter" domainObjectName="AdGroupAppTargetFilterModel" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true" />
|
||||
<table tableName="dsp_t_group_target_audit" domainObjectName="GroupTargetAuditModel" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true" />
|
||||
<!--
|
||||
<table tableName="dsp_t_advertiser" domainObjectName="AdvertiserModel" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true" />
|
||||
<table tableName="dsp_t_open_request_data" domainObjectName="OpenRequestDataModel" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true"></table>
|
||||
|
||||
27
src/main/resources/log4j.properties
Normal file
27
src/main/resources/log4j.properties
Normal file
@@ -0,0 +1,27 @@
|
||||
### direct log messages to stdout and logFile###
|
||||
log4j.rootCategory=INFO, stdout,logFile
|
||||
|
||||
# OpenSymphony Stuff
|
||||
log4j.logger.com.opensymphony=INFO
|
||||
log4j.logger.org.apache.struts2=INFO
|
||||
log4j.logger.org.apache.commons=INFO
|
||||
|
||||
# Spring Stuff
|
||||
log4j.logger.org.springframework=INFO
|
||||
log4j.logger.org.springframework.oxm=INFO
|
||||
|
||||
# Hibernate Stuff
|
||||
log4j.logger.org.hibernate=INFO
|
||||
log4j.logger.org.hibernate.type=INFO
|
||||
log4j.logger.org.hibernate.tool.hbm2ddl=INFO
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=[%p] %-d{yyyy-MM-dd HH\:mm\:ss} [%t] [%c.%M\:%L] %m%n
|
||||
|
||||
log4j.appender.logFile=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.logFile.File=${webapp.root}/logs/amq.log
|
||||
log4j.appender.logFile.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.logFile.layout.ConversionPattern=[%p] %-d{yyyy-MM-dd HH\:mm\:ss} [%t] [%c.%M\:%L] %m%n
|
||||
log4j.appender.logFile.MaxFileSize = 5MB
|
||||
log4j.appender.logFile.MaxBackupIndex =3
|
||||
40
src/main/resources/spring-mvc.xml
Normal file
40
src/main/resources/spring-mvc.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- 查找最新的schemaLocation 访问 http://www.springframework.org/schema/ -->
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/aop
|
||||
http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-4.0.xsd
|
||||
http://www.springframework.org/schema/mvc
|
||||
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
|
||||
http://www.springframework.org/schema/tx
|
||||
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
|
||||
|
||||
<!-- 启用MVC注解 -->
|
||||
<mvc:annotation-driven />
|
||||
|
||||
<!-- 静态资源文件,不会被Spring MVC拦截 -->
|
||||
<mvc:resources location="/resources/" mapping="/resources/**"/>
|
||||
|
||||
<!-- 指定Sping组件扫描的基本包路径 -->
|
||||
<context:component-scan base-package="osc.git.eh3.springamq" >
|
||||
<!-- 这里只扫描Controller,不可重复加载Service -->
|
||||
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
|
||||
</context:component-scan>
|
||||
|
||||
<!-- JSP视图解析器-->
|
||||
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
<property name="prefix" value="/WEB-INF/views/" />
|
||||
<property name="suffix" value=".jsp" />
|
||||
<!-- 定义其解析视图的order顺序为1 -->
|
||||
<property name="order" value="1" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user