更新zheng-api

This commit is contained in:
shuzheng 2017-04-05 23:36:53 +08:00
parent aa17a52d31
commit b92c6c0976
5 changed files with 41 additions and 52 deletions

View File

@ -14,7 +14,7 @@ public class ZhengApiRpcServiceApplication {
public static void main(String[] args) {
_log.info(">>>>> zheng-api-rpc-service 正在启动 <<<<<");
new ClassPathXmlApplicationContext("classpath*:applicationContext*.xml");
new ClassPathXmlApplicationContext("classpath:META-INF/spring/*.xml");
_log.info(">>>>> zheng-api-rpc-service 启动完成 <<<<<");
}

View File

@ -45,9 +45,6 @@ public class ApiServiceImpl implements ApiService {
@Autowired
private CmsTagService cmsTagService;
@Autowired
private UserService userService;
@Override
public String hello(String name) {
return "hello," + name + "!";

View File

@ -33,7 +33,5 @@
<dubbo:reference id="cmsCommentService" interface="com.zheng.cms.rpc.api.CmsCommentService" mock="true"/>
<!-- 标签 -->
<dubbo:reference id="cmsTagService" interface="com.zheng.cms.rpc.api.CmsTagService" mock="true"/>
<!-- 用户 -->
<dubbo:reference id="userService" interface="com.zheng.cms.rpc.api.UserService" mock="true"/>
</beans>

View File

@ -27,7 +27,7 @@ public class DefaultMessageQueueListener implements MessageListener {
if (message instanceof TextMessage) {
TextMessage textMessage = (TextMessage) message;
try {
_log.info("消费消息{}", textMessage.getText());
_log.info("消费{}", textMessage.getText());
} catch (Exception e){
e.printStackTrace();
}

View File

@ -1,53 +1,47 @@
<?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"
xmlns:jms="http://www.springframework.org/schema/jms"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/jms
http://www.springframework.org/schema/jms/spring-jms-4.1.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.8.0.xsd">
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
<!-- 连接工厂 -->
<bean id="activeMqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="${AvtiveMQ.brokerURL}"/>
<property name="useAsyncSend" value="true"/>
</bean>
<bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="activeMqConnectionFactory"/>
<property name="sessionCacheSize" value="100"/>
</bean>
<!-- 连接工厂 -->
<bean id="activeMqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="${AvtiveMQ.brokerURL}"/>
<property name="useAsyncSend" value="true"/>
</bean>
<bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="activeMqConnectionFactory"/>
<property name="sessionCacheSize" value="100"/>
</bean>
<!-- 点对点队列 -->
<bean id="defaultQueueDestination" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg index="0" value="com.zheng.api.server.queue.default"/>
</bean>
<!-- 一对多队列 -->
<bean id="defaultTopicDestination" class="org.apache.activemq.command.ActiveMQTopic">
<constructor-arg index="0" value="com.zheng.api.server.topic.default"/>
</bean>
<!-- 点对点队列 -->
<bean id="defaultQueueDestination" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg index="0" value="com.zheng.api.server.queue.default"/>
</bean>
<!-- 一对多队列 -->
<bean id="defaultTopicDestination" class="org.apache.activemq.command.ActiveMQTopic">
<constructor-arg index="0" value="com.zheng.api.server.topic.default"/>
</bean>
<!-- 生产者 -->
<bean id="jmsQueueTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="pubSubDomain" value="false" />
</bean>
<bean id="jmsTopicTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="pubSubDomain" value="true" />
</bean>
<!-- 生产者 -->
<bean id="jmsQueueTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="pubSubDomain" value="false"/>
</bean>
<bean id="jmsTopicTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="pubSubDomain" value="true"/>
</bean>
<!-- 消费者 -->
<bean id="defaultMessageQueueListener" class="com.zheng.api.server.jms.DefaultMessageQueueListener"/>
<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="destination" ref="defaultQueueDestination"/>
<property name="messageListener" ref="defaultMessageQueueListener"/>
<property name="sessionTransacted" value="true"/>
<!--<property name="concurrency" value="4-10"/>-->
</bean>
<!-- 消费者 -->
<bean id="defaultMessageQueueListener" class="com.zheng.api.server.jms.DefaultMessageQueueListener"/>
<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="destination" ref="defaultQueueDestination"/>
<property name="messageListener" ref="defaultMessageQueueListener"/>
<property name="sessionTransacted" value="true"/>
<!--<property name="concurrency" value="4-10"/>-->
</bean>
</beans>