消息推送改造

This commit is contained in:
yiyan
2019-06-01 22:57:59 +08:00
parent aa3b3825b0
commit d00b461151
6 changed files with 199 additions and 45 deletions
+43 -3
View File
@@ -17,7 +17,17 @@
default-lazy-init="true">
<!-- 导入外部的properties文件-->
<context:property-placeholder location="classpath*:jdbc.properties" ignore-unresolvable="true"/>
<!-- 导入外部的properties文件-->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" >
<list>
<value>classpath:mq.properties</value>
<value>classpath:jdbc.properties</value>
<value>classpath:jPpush.properties</value>
</list>
</property>
</bean>
<!-- 注册识别注解 -->
<context:component-scan base-package="com.ifish.converter,com.ifish.daoImpl,com.ifish.serviceImpl,com.ifishNew.help"/>
@@ -55,9 +65,8 @@
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
<prop key="hibernate.query.substitutions">${hibernate.query.substitutions}</prop>
<prop key="hibernate.jdbc.batch_size">${"hibernate.jdbc.batch_size"}</prop>
<prop key="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</prop>
</props>
</property>
</bean>
@@ -86,4 +95,35 @@
<value>${netease.appSecret}</value>
</constructor-arg>
</bean>
<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory" >
<property name="brokerURL" value="${broker_url}" />
<property name="userName" value="${username}" />
<property name="password" value="${password}" />
</bean>
<bean id="jmsFactory" class="org.apache.activemq.pool.PooledConnectionFactory"
destroy-method="stop">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="maxConnections" value="100"></property>
</bean>
<!--使用缓存可以提升效率-->
<bean id="cachingConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="jmsFactory"/>
<property name="sessionCacheSize" value="1"/>
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="cachingConnectionFactory"/>
<property name="messageConverter">
<bean class="org.springframework.jms.support.converter.SimpleMessageConverter"/>
</property>
</bean>
<!-- 定义消息推送消息队列(Queue -->
<bean id="ifish7PushQueueDestination" class="org.apache.activemq.command.ActiveMQQueue">
<!-- 设置消息队列的名字 -->
<constructor-arg>
<value>${queue_push_name}</value>
</constructor-arg>
</bean>
</beans>
+7
View File
@@ -0,0 +1,7 @@
#broker_url=tcp://test.ifish7.com:61616
broker_url=tcp://www.ifish7.com:61616
username=admin
#password=admin
password=adminifish7
queue_data_name=ifishDataMq
queue_push_name=ifishPushMq