浏览代码

添加注释

liutong3 5 年之前
父节点
当前提交
69fef4d69a

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

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

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

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

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

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

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

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

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

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

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

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

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

11
    </content>
11
    </content>
12
    <orderEntry type="inheritedJdk" />
12
    <orderEntry type="inheritedJdk" />
13
    <orderEntry type="sourceFolder" forTests="false" />
13
    <orderEntry type="sourceFolder" forTests="false" />
14
    <orderEntry type="library" name="Maven: com.ai.ipu:ipu-zk:3.1-SNAPSHOT" level="project" />
15
    <orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.4.9" level="project" />
14
    <orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.4.9" level="project" />
16
    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.6.1" level="project" />
15
    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.6.1" level="project" />
17
    <orderEntry type="library" name="Maven: org.slf4j:slf4j-log4j12:1.6.1" level="project" />
16
    <orderEntry type="library" name="Maven: org.slf4j:slf4j-log4j12:1.6.1" level="project" />
18
    <orderEntry type="library" name="Maven: log4j:log4j:1.2.16" level="project" />
17
    <orderEntry type="library" name="Maven: log4j:log4j:1.2.16" level="project" />
19
    <orderEntry type="library" name="Maven: jline:jline:0.9.94" level="project" />
18
    <orderEntry type="library" name="Maven: jline:jline:0.9.94" level="project" />
20
    <orderEntry type="library" name="Maven: io.netty:netty:3.10.5.Final" level="project" />
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
    <orderEntry type="library" name="Maven: org.apache.curator:curator-framework:2.8.0" level="project" />
37
    <orderEntry type="library" name="Maven: org.apache.curator:curator-framework:2.8.0" level="project" />
22
    <orderEntry type="library" name="Maven: org.apache.curator:curator-client:2.8.0" level="project" />
38
    <orderEntry type="library" name="Maven: org.apache.curator:curator-client:2.8.0" level="project" />
23
    <orderEntry type="library" name="Maven: org.apache.curator:curator-recipes:2.8.0" level="project" />
39
    <orderEntry type="library" name="Maven: org.apache.curator:curator-recipes:2.8.0" level="project" />
24
    <orderEntry type="library" name="Maven: com.101tec:zkclient:0.10" level="project" />
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
    <orderEntry type="library" name="Maven: com.ai.ipu:ipu-basic:3.1-SNAPSHOT" level="project" />
49
    <orderEntry type="library" name="Maven: com.ai.ipu:ipu-basic:3.1-SNAPSHOT" level="project" />
27
    <orderEntry type="library" name="Maven: com.ai.ipu:ipu-common:3.1-SNAPSHOT" level="project" />
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
    <orderEntry type="library" name="Maven: com.mashape.unirest:unirest-java:1.3.8" level="project" />
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
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.0.1" level="project" />
53
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.0.1" level="project" />
33
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.3.2" level="project" />
54
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.3.2" level="project" />
34
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.3.2" level="project" />
55
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.3.2" level="project" />
35
    <orderEntry type="library" name="Maven: org.json:json:20131018" level="project" />
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
    <orderEntry type="library" name="Maven: jaxen:jaxen:1.1.1" level="project" />
63
    <orderEntry type="library" name="Maven: jaxen:jaxen:1.1.1" level="project" />
39
    <orderEntry type="library" name="Maven: jdom:jdom:1.0" level="project" />
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
    <orderEntry type="library" name="Maven: xom:xom:1.0" level="project" />
65
    <orderEntry type="library" name="Maven: xom:xom:1.0" level="project" />
42
    <orderEntry type="library" name="Maven: xerces:xmlParserAPIs:2.6.2" level="project" />
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
    <orderEntry type="library" name="Maven: com.ibm.icu:icu4j:2.6.1" level="project" />
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
    <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.4" level="project" />
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
    <orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.38" level="project" />
76
    <orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.38" level="project" />
50
    <orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
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
    <orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
78
    <orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
53
    <orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
79
    <orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
54
  </component>
80
  </component>

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

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