liutong3 5 vuotta sitten
vanhempi
commit
69fef4d69a

+ 1 - 0
ipu-kafka-example/pom.xml

@ -15,6 +15,7 @@
15 15
    </properties>
16 16
17 17
    <dependencies>
18
        <!-- msgframe依赖jar -->
18 19
        <dependency>
19 20
            <groupId>com.ai.aif.msgframe</groupId>
20 21
            <artifactId>msgframe-common</artifactId>

+ 9 - 0
ipu-kafka-example/src/main/java/com/ai/ipu/example/kafka/KafkaProducerExample.java

@ -44,6 +44,9 @@ public class KafkaProducerExample {
44 44
        return MESSAGE + "_" + new Date().getTime();
45 45
    }
46 46
47
    /**
48
     * 普通消息发送
49
     */
47 50
    private void sendMessage(String topic, String text) {
48 51
        try {
49 52
            MfProducerClient client = new MfProducerClient();
@ -57,6 +60,9 @@ public class KafkaProducerExample {
57 60
        }
58 61
    }
59 62
63
    /**
64
     * 异步消息发送
65
     */
60 66
    private void sendAsyncMessage(String topic, final String text) {
61 67
        try {
62 68
            MfProducerClient client = new MfProducerClient();
@ -77,6 +83,9 @@ public class KafkaProducerExample {
77 83
        }
78 84
    }
79 85
86
    /**
87
     * 顺序消息发送
88
     */
80 89
    private void sendOrderMessage(String topic, final String text, String orderId) {
81 90
        try {
82 91
            MfProducerClient client = new MfProducerClient();

+ 1 - 0
ipu-rabbitmq-example/pom.xml

@ -15,6 +15,7 @@
15 15
    </properties>
16 16
17 17
    <dependencies>
18
        <!-- msgframe依赖jar -->
18 19
        <dependency>
19 20
            <groupId>com.ai.aif.msgframe</groupId>
20 21
            <artifactId>msgframe-common</artifactId>

+ 9 - 0
ipu-rabbitmq-example/src/main/java/com/ai/ipu/example/rabbitmq/RabbitMQProducerExample.java

@ -44,6 +44,9 @@ public class RabbitMQProducerExample {
44 44
        return MESSAGE + "_" + new Date().getTime();
45 45
    }
46 46
47
    /**
48
     * 普通消息发送
49
     */
47 50
    private void sendMessage(String topic, String text) {
48 51
        try {
49 52
            MfProducerClient client = new MfProducerClient();
@ -57,6 +60,9 @@ public class RabbitMQProducerExample {
57 60
        }
58 61
    }
59 62
63
    /**
64
     * 异步消息发送
65
     */
60 66
    private void sendAsyncMessage(String topic, final String text) {
61 67
        try {
62 68
            MfProducerClient client = new MfProducerClient();
@ -77,6 +83,9 @@ public class RabbitMQProducerExample {
77 83
        }
78 84
    }
79 85
86
    /**
87
     * 顺序消息发送
88
     */
80 89
    private void sendOrderMessage(String topic, final String text, String orderId) {
81 90
        try {
82 91
            MfProducerClient client = new MfProducerClient();

+ 1 - 0
ipu-rocketmq-example/pom.xml

@ -15,6 +15,7 @@
15 15
    </properties>
16 16
17 17
    <dependencies>
18
        <!-- msgframe依赖jar -->
18 19
        <dependency>
19 20
            <groupId>com.ai.aif.msgframe</groupId>
20 21
            <artifactId>msgframe-common</artifactId>

+ 12 - 0
ipu-rocketmq-example/src/main/java/com/ai/ipu/example/rocketmq/RocketMQProducerExample.java

@ -49,6 +49,9 @@ public class RocketMQProducerExample {
49 49
        return MESSAGE + "_" + new Date().getTime();
50 50
    }
51 51
52
    /**
53
     * 普通消息发送
54
     */
52 55
    private void sendMessage(String topic, String text) {
53 56
        try {
54 57
            MfProducerClient client = new MfProducerClient();
@ -63,6 +66,9 @@ public class RocketMQProducerExample {
63 66
        }
64 67
    }
65 68
69
    /**
70
     * 异步消息发送
71
     */
66 72
    private void sendAsyncMessage(String topic, final String text) {
67 73
        try {
68 74
            MfProducerClient client = new MfProducerClient();
@ -84,6 +90,9 @@ public class RocketMQProducerExample {
84 90
        }
85 91
    }
86 92
93
    /**
94
     * 顺序消息发送
95
     */
87 96
    private void sendOrderMessage(String topic, final String text, String orderId) {
88 97
        try {
89 98
            MfProducerClient client = new MfProducerClient();
@ -98,6 +107,9 @@ public class RocketMQProducerExample {
98 107
        }
99 108
    }
100 109
110
    /**
111
     * 单向消息发送
112
     */
101 113
    private void sendOneWay(String topic, final String text) {
102 114
        try {
103 115
            MfProducerClient client = new MfProducerClient();

+ 39 - 13
ipu-zk-example/ipu-zk-example.iml

@ -11,44 +11,70 @@
11 11
    </content>
12 12
    <orderEntry type="inheritedJdk" />
13 13
    <orderEntry type="sourceFolder" forTests="false" />
14
    <orderEntry type="library" name="Maven: com.ai.ipu:ipu-zk:3.1-SNAPSHOT" level="project" />
15 14
    <orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.4.9" level="project" />
16 15
    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.6.1" level="project" />
17 16
    <orderEntry type="library" name="Maven: org.slf4j:slf4j-log4j12:1.6.1" level="project" />
18 17
    <orderEntry type="library" name="Maven: log4j:log4j:1.2.16" level="project" />
19 18
    <orderEntry type="library" name="Maven: jline:jline:0.9.94" level="project" />
20 19
    <orderEntry type="library" name="Maven: io.netty:netty:3.10.5.Final" level="project" />
20
    <orderEntry type="library" name="Maven: com.google.guava:guava:16.0.1" level="project" />
21
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.3.2" level="project" />
22
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.3.1" level="project" />
23
    <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.3" level="project" />
24
    <orderEntry type="library" name="Maven: xerces:xercesImpl:2.6.2" level="project" />
25
    <orderEntry type="library" name="Maven: xalan:xalan:2.6.0" level="project" />
26
    <orderEntry type="library" name="Maven: org.jsoup:jsoup:1.7.2" level="project" />
27
    <orderEntry type="library" name="Maven: org.apache.poi:poi:3.9" level="project" />
28
    <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.5" level="project" />
29
    <orderEntry type="library" name="Maven: com.ai.ipu:ipu-zk:3.1-SNAPSHOT" level="project" />
30
    <orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.5.5" level="project" />
31
    <orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper-jute:3.5.5" level="project" />
32
    <orderEntry type="library" name="Maven: org.apache.yetus:audience-annotations:0.5.0" level="project" />
33
    <orderEntry type="library" name="Maven: io.netty:netty-all:4.1.29.Final" level="project" />
34
    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
35
    <orderEntry type="library" name="Maven: org.slf4j:slf4j-log4j12:1.7.25" level="project" />
36
    <orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
21 37
    <orderEntry type="library" name="Maven: org.apache.curator:curator-framework:2.8.0" level="project" />
22 38
    <orderEntry type="library" name="Maven: org.apache.curator:curator-client:2.8.0" level="project" />
23 39
    <orderEntry type="library" name="Maven: org.apache.curator:curator-recipes:2.8.0" level="project" />
24 40
    <orderEntry type="library" name="Maven: com.101tec:zkclient:0.10" level="project" />
25
    <orderEntry type="library" name="Maven: com.google.guava:guava:16.0.1" level="project" />
41
    <orderEntry type="library" name="Maven: com.google.guava:guava:27.0-jre" level="project" />
42
    <orderEntry type="library" name="Maven: com.google.guava:failureaccess:1.0" level="project" />
43
    <orderEntry type="library" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
44
    <orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
45
    <orderEntry type="library" name="Maven: org.checkerframework:checker-qual:2.5.2" level="project" />
46
    <orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.2.0" level="project" />
47
    <orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.1" level="project" />
48
    <orderEntry type="library" name="Maven: org.codehaus.mojo:animal-sniffer-annotations:1.17" level="project" />
26 49
    <orderEntry type="library" name="Maven: com.ai.ipu:ipu-basic:3.1-SNAPSHOT" level="project" />
27 50
    <orderEntry type="library" name="Maven: com.ai.ipu:ipu-common:3.1-SNAPSHOT" level="project" />
51
    <orderEntry type="library" name="Maven: com.ai.wade:wade-data:1.0" level="project" />
28 52
    <orderEntry type="library" name="Maven: com.mashape.unirest:unirest-java:1.3.8" level="project" />
29
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.3.2" level="project" />
30
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.3.1" level="project" />
31
    <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.3" level="project" />
32 53
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.0.1" level="project" />
33 54
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.3.2" level="project" />
34 55
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.3.2" level="project" />
35 56
    <orderEntry type="library" name="Maven: org.json:json:20131018" level="project" />
36
    <orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
37
    <orderEntry type="library" name="Maven: xml-apis:xml-apis:1.0.b2" level="project" />
57
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.5" level="project" />
58
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.9" level="project" />
59
    <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
60
    <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" />
61
    <orderEntry type="library" name="Maven: dom4j:dom4j:1.6" level="project" />
62
    <orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
38 63
    <orderEntry type="library" name="Maven: jaxen:jaxen:1.1.1" level="project" />
39 64
    <orderEntry type="library" name="Maven: jdom:jdom:1.0" level="project" />
40
    <orderEntry type="library" name="Maven: xerces:xercesImpl:2.6.2" level="project" />
41 65
    <orderEntry type="library" name="Maven: xom:xom:1.0" level="project" />
42 66
    <orderEntry type="library" name="Maven: xerces:xmlParserAPIs:2.6.2" level="project" />
43
    <orderEntry type="library" name="Maven: xalan:xalan:2.6.0" level="project" />
44 67
    <orderEntry type="library" name="Maven: com.ibm.icu:icu4j:2.6.1" level="project" />
45
    <orderEntry type="library" name="Maven: org.jsoup:jsoup:1.7.2" level="project" />
68
    <orderEntry type="library" name="Maven: xalan:xalan:2.7.2" level="project" />
69
    <orderEntry type="library" name="Maven: xalan:serializer:2.7.2" level="project" />
70
    <orderEntry type="library" name="Maven: xerces:xercesImpl:2.12.0" level="project" />
71
    <orderEntry type="library" name="Maven: org.jsoup:jsoup:1.9.2" level="project" />
46 72
    <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.4" level="project" />
47
    <orderEntry type="library" name="Maven: org.apache.poi:poi:3.9" level="project" />
48
    <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.5" level="project" />
73
    <orderEntry type="library" name="Maven: org.apache.poi:poi:4.1.0" level="project" />
74
    <orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.3" level="project" />
75
    <orderEntry type="library" name="Maven: org.apache.commons:commons-math3:3.6.1" level="project" />
49 76
    <orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.38" level="project" />
50 77
    <orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
51
    <orderEntry type="library" name="Maven: com.ai.wade:wade-data:1.0" level="project" />
52 78
    <orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
53 79
    <orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
54 80
  </component>

+ 19 - 3
ipu-zk-example/src/main/java/com/ai/ipu/example/zookeeper/ZookeeperExample.java

@ -35,23 +35,39 @@ public class ZookeeperExample {
35 35
        OperType.Define.setVersionCtrl(VERSIONCTL);
36 36
    }
37 37
38
    /**
39
     * 给根节点赋值
40
     * @throws Exception
41
     */
38 42
    @Test
39
    public void testSetValue() throws Exception{
43
    public void testSetValueToRoot() throws Exception{
40 44
        LOG.debug(Boolean.toString(client.setValue(OperType.Define, PATH, "myData1")));
41 45
    }
42 46
47
    /**
48
     * 给叶子节点赋值,会触发监听器
49
     * @throws Exception
50
     */
43 51
    @Test
44
    public void testSetValue2() throws Exception{
52
    public void testSetValueToLeaf() throws Exception{
45 53
        LOG.debug(Boolean.toString(client.setValue(OperType.Define, PATH2, "myData1")));
46 54
    }
47 55
56
    /**
57
     * 获取节点的值
58
     * @throws Exception
59
     */
48 60
    @Test
49 61
    public void testGetValue() throws Exception {
50 62
        LOG.debug(client.getValue(OperType.Define, PATH2));
51 63
    }
52 64
65
    /**
66
     * 删除节点
67
     * @throws Exception
68
     */
53 69
    @Test
54
    public void deleteNode() throws Exception {
70
    public void testDeleteNode() throws Exception {
55 71
        LOG.debug(Boolean.toString(client.delete(OperType.Define, PATH2)));
56 72
    }
57 73
}