新增:zhub 验权处理
This commit is contained in:
parent
90378c5daf
commit
2296a7fb15
@ -34,6 +34,7 @@ public class ZHubClient extends AbstractConsumer implements IConsumer, IProducer
|
|||||||
private String addr = "127.0.0.1:1216";
|
private String addr = "127.0.0.1:1216";
|
||||||
//private String password = "";
|
//private String password = "";
|
||||||
private String groupid = "";
|
private String groupid = "";
|
||||||
|
private String auth = "";
|
||||||
|
|
||||||
private OutputStream writer;
|
private OutputStream writer;
|
||||||
private BufferedReader reader;
|
private BufferedReader reader;
|
||||||
@ -54,10 +55,11 @@ public class ZHubClient extends AbstractConsumer implements IConsumer, IProducer
|
|||||||
private boolean isMain = false;*/
|
private boolean isMain = false;*/
|
||||||
private static final Map<String, ZHubClient> mainHub = new HashMap<>(); // 127.0.0.1:1216 - ZHubClient
|
private static final Map<String, ZHubClient> mainHub = new HashMap<>(); // 127.0.0.1:1216 - ZHubClient
|
||||||
|
|
||||||
public ZHubClient(String addr, String groupid, String appname) {
|
public ZHubClient(String addr, String groupid, String appname, String auth) {
|
||||||
this.addr = addr;
|
this.addr = addr;
|
||||||
this.groupid = groupid;
|
this.groupid = groupid;
|
||||||
this.APP_NAME = appname;
|
this.APP_NAME = appname;
|
||||||
|
this.auth = auth;
|
||||||
init(null);
|
init(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +170,10 @@ public class ZHubClient extends AbstractConsumer implements IConsumer, IProducer
|
|||||||
String topic = reader.readLine(); // name
|
String topic = reader.readLine(); // name
|
||||||
|
|
||||||
timerQueue.add(timerMap.get(topic));
|
timerQueue.add(timerMap.get(topic));
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.finest(readLine);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (e instanceof SocketException) {
|
if (e instanceof SocketException) {
|
||||||
initSocket(Integer.MAX_VALUE);
|
initSocket(Integer.MAX_VALUE);
|
||||||
@ -345,6 +350,7 @@ public class ZHubClient extends AbstractConsumer implements IConsumer, IProducer
|
|||||||
if (groupid == null || groupid.isEmpty()) {
|
if (groupid == null || groupid.isEmpty()) {
|
||||||
throw new RuntimeException("ZHubClient groupid can not is empty");
|
throw new RuntimeException("ZHubClient groupid can not is empty");
|
||||||
}
|
}
|
||||||
|
send("auth", auth);
|
||||||
send("groupid " + groupid);
|
send("groupid " + groupid);
|
||||||
|
|
||||||
StringBuffer buf = new StringBuffer("subscribe lock");
|
StringBuffer buf = new StringBuffer("subscribe lock");
|
||||||
|
@ -13,7 +13,7 @@ public class HelloService {
|
|||||||
@Before
|
@Before
|
||||||
public void init() {
|
public void init() {
|
||||||
|
|
||||||
zhub = new ZHubClient("127.0.0.1:1216", "g-dev", "DEV-LOCAL");
|
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.init(Map.of("host", "47.111.150.118", "port", "6066", "groupid", "g-dev", "appname", "DEV-LOCAL"));
|
||||||
|
|
||||||
// Function<Rpc<T>, RpcResult<R>> fun
|
// Function<Rpc<T>, RpcResult<R>> fun
|
||||||
|
Loading…
Reference in New Issue
Block a user