修改:包名称

This commit is contained in:
梁显优 2023-03-05 19:36:00 +08:00
parent 2296a7fb15
commit 144b99c3d2
12 changed files with 51 additions and 24 deletions

10
pom.xml
View File

@ -9,8 +9,8 @@
<version>1.0</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
@ -19,6 +19,12 @@
<artifactId>gson</artifactId>
<version>2.8.8</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>

View File

@ -1,8 +1,8 @@
package com.zdemo;
package net.tccn;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.zdemo.zhub.Rpc;
import net.tccn.zhub.Rpc;
import java.util.HashMap;
import java.util.HashSet;

View File

@ -1,4 +1,4 @@
package com.zdemo;
package net.tccn;
/**
* 发布订阅 事件

View File

@ -1,4 +1,4 @@
package com.zdemo;
package net.tccn;
import com.google.gson.reflect.TypeToken;

View File

@ -1,4 +1,4 @@
package com.zdemo;
package net.tccn;
import com.google.gson.reflect.TypeToken;

View File

@ -1,4 +1,4 @@
package com.zdemo;
package net.tccn;
import java.util.logging.Logger;

View File

@ -1,4 +1,4 @@
package com.zdemo;
package net.tccn;
import com.google.gson.reflect.TypeToken;

View File

@ -1,4 +1,4 @@
package com.zdemo.zhub;
package net.tccn.zhub;
// ================================================== lock ==================================================
public class Lock {

View File

@ -1,4 +1,4 @@
package com.zdemo.zhub;
package net.tccn.zhub;
import com.google.gson.Gson;
import com.google.gson.annotations.Expose;

View File

@ -1,4 +1,4 @@
package com.zdemo.zhub;
package net.tccn.zhub;
public class RpcResult<R> {
private String ruk;

View File

@ -1,10 +1,10 @@
package com.zdemo.zhub;
package net.tccn.zhub;
import com.google.gson.reflect.TypeToken;
import com.zdemo.AbstractConsumer;
import com.zdemo.Event;
import com.zdemo.IConsumer;
import com.zdemo.IProducer;
import net.tccn.AbstractConsumer;
import net.tccn.Event;
import net.tccn.IConsumer;
import net.tccn.IProducer;
import net.tccn.timer.Timers;
import java.io.BufferedReader;

View File

@ -1,6 +1,7 @@
import com.zdemo.IConsumer;
import com.zdemo.zhub.RpcResult;
import com.zdemo.zhub.ZHubClient;
import com.google.gson.reflect.TypeToken;
import net.tccn.IType;
import net.tccn.zhub.RpcResult;
import net.tccn.zhub.ZHubClient;
import org.junit.Before;
import org.junit.Test;
@ -13,8 +14,15 @@ public class HelloService {
@Before
public void init() {
zhub = new ZHubClient("127.0.0.1:1216", "g-dev", "DEV-LOCAL", "zchd@123456");
//zhub.init(Map.of("host", "47.111.150.118", "port", "6066", "groupid", "g-dev", "appname", "DEV-LOCAL"));
//zhub = new ZHubClient("127.0.0.1:1216", "g-dev", "DEV-LOCAL", "zchd@123456");
zhub = new ZHubClient("47.111.150.118:6066", "g-dev", "DEV-LOCAL", "zchd@123456");
zhub.subscribe("tv:test", x -> {
System.out.println(x);
});
//zhub.init(Kv.of("host", "47.111.150.118", "port", "6066", "groupid", "g-dev", "appname", "DEV-LOCAL"));
// Function<Rpc<T>, RpcResult<R>> fun
/*zhub.rpcSubscribe("x", new TypeToken<String>() {
@ -51,9 +59,22 @@ public class HelloService {
@Test
public void rpcTest() {
//RpcResult<String> rpc = zhub.rpc("wx:users", Map.of("appId", "wxa554ec3ab3bf1fc7"), IConsumer.TYPE_TOKEN_STRING);
RpcResult<String> rpc = zhub.rpc("a", "fa", IConsumer.TYPE_TOKEN_STRING);
//RpcResult<String> rpc = zhub.rpc("a", "fa", IConsumer.TYPE_TOKEN_STRING);
zhub.publish("tv:test", "hello ym!");
System.out.println(rpc.getResult());
zhub.subscribe("tv:abx", x -> {
System.out.println(x);
});
zhub.rpcSubscribe("rpc-x", IType.STRING, x -> {
return x.buildResp(x.getValue().toUpperCase());
});
try {
Thread.sleep(3000 * 30000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
/*RpcResult<FileToken> x = zhub.rpc("rpc:file:up-token", Map.of(), new TypeToken<>() {