Browse Source

代码优化

huangbo 6 years ago
parent
commit
fc694e8d6d

+ 7 - 1
ipu-rest-demo/pom.xml

@ -32,6 +32,7 @@
32 32
	<properties>
33 33
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
34 34
		<msgframe>1.9.2</msgframe>
35
		<jms>1.1</jms>
35 36
	</properties>
36 37
37 38
	<dependencies>
@ -80,8 +81,13 @@
80 81
		<dependency>
81 82
			<groupId>com.ai.aif.msgframe</groupId>
82 83
  			<artifactId>msgframe-client</artifactId>
83
  			<version>1.9.2</version>
84
  			<version>${msgframe}</version>
84 85
  		</dependency>
86
  		<dependency>
87
		    <groupId>javax.jms</groupId>
88
		    <artifactId>jms</artifactId>
89
		    <version>${jms}</version>
90
		</dependency>
85 91
	</dependencies>
86 92
87 93
	<build>

+ 2 - 1
ipu-rest-demo/src/main/resources/dev/dubbo-consumer-simple.xml

@ -9,7 +9,8 @@
9 9
	<dubbo:application name="ipu-rest-demo" />
10 10
	<!-- 关闭重试,延长超时 -->
11 11
	<dubbo:consumer retries="0" timeout="2000"/>	<!-- client="netty4" -->
12
	<dubbo:registry address="127.0.0.1:20880" /> <!-- 127.0.0.1 -->
12
	<!-- 换成实际地址可以解决无法注册的异常 -->
13
	<dubbo:registry address="127.0.0.1:20880" />
13 14
	<!-- 全局配置 end=========================== -->
14 15

15 16
	<!-- 服务注册配置 start=========================== -->

+ 3 - 3
ipu-service-demo/pom.xml

@ -51,9 +51,9 @@
51 51
		</dependency>
52 52
		<!-- msgframe相关依赖 -->
53 53
		<dependency>
54
		  <groupId>com.ai.aif.msgframe</groupId>
55
		  <artifactId>msgframe-server</artifactId>
56
		  <version>${msgframe}</version>
54
		  	<groupId>com.ai.aif.msgframe</groupId>
55
		  	<artifactId>msgframe-server</artifactId>
56
		  	<version>${msgframe}</version>
57 57
		</dependency>
58 58
	</dependencies>
59 59
</project>

+ 5 - 2
ipu-service-demo/src/main/java/com/ai/ipu/service/IpuServiceDemoStart.java

@ -2,6 +2,9 @@ package com.ai.ipu.service;
2 2

3 3
import org.springframework.context.support.ClassPathXmlApplicationContext;
4 4

5
import com.ai.aif.msgframe.consumer.MfConsumerClient;
6
import com.ai.aif.msgframe.consumer.MfServiceStartup;
7

5 8
public class IpuServiceDemoStart {
6 9
    public final static String MODE = "simple";
7 10
    public final static String DUBBO_PROVIDER_CONFIG = "dubbo-provider-" + MODE + ".xml";
@ -14,9 +17,9 @@ public class IpuServiceDemoStart {
14 17
        context.start();
15 18
        /*启动消息中间件的消费者服务*/
16 19
        /*启动所有的订阅*/
17
        //MfServiceStartup.main();
20
        MfServiceStartup.main();
18 21
        /*启动指定的订阅*/
19
        //MfConsumerClient.subscribe("myTestTopic", "*", "com.ai.ipu.service.demo.consumer.ConsumerProcessorImpl");
22
        MfConsumerClient.subscribe("myTestTopic", "*", "com.ai.ipu.service.demo.consumer.ConsumerProcessorImpl");
20 23
        System.in.read(); // press any key to exit
21 24
    }
22 25
}

+ 8 - 7
ipu-service-demo/src/main/java/com/ai/ipu/service/demo/consumer/ConsumerProcessorImpl.java

@ -2,19 +2,21 @@ package com.ai.ipu.service.demo.consumer;
2 2

3 3
import org.springframework.context.support.ClassPathXmlApplicationContext;
4 4

5
//import com.ai.aif.msgframe.common.IConsumerProcessor;
6
//import com.ai.aif.msgframe.common.exception.ConsumerException;
7
//import com.ai.aif.msgframe.common.message.MsgFMessage;
8
//import com.ai.aif.msgframe.common.message.MsgFTextMessage;
5
import com.ai.aif.msgframe.common.IConsumerProcessor;
6
import com.ai.aif.msgframe.common.exception.ConsumerException;
7
import com.ai.aif.msgframe.common.message.MsgFMessage;
8
import com.ai.aif.msgframe.common.message.MsgFTextMessage;
9 9
import com.ai.ipu.service.IpuServiceDemoStart;
10 10
import com.ai.ipu.service.demo.IDbService;
11 11
import com.ailk.common.data.IData;
12 12
import com.ailk.common.data.impl.DataMap;
13 13

14 14

15
/*public class ConsumerProcessorImpl implements IConsumerProcessor {
15
public class ConsumerProcessorImpl implements IConsumerProcessor {
16 16

17
    @SuppressWarnings("rawtypes")
17 18
    public Object process(MsgFMessage msg) throws ConsumerException{
19
        @SuppressWarnings("resource")
18 20
        ClassPathXmlApplicationContext context = 
19 21
                new ClassPathXmlApplicationContext(new String[] { IpuServiceDemoStart.DUBBO_CONSUMER_CONFIG });
20 22
        context.start();
@ -29,5 +31,4 @@ import com.ailk.common.data.impl.DataMap;
29 31
        }
30 32
        return true;
31 33
    }
32

33
}*/
34
}