diff --git a/conf/application.properties b/conf/application.properties
new file mode 100644
index 0000000..3987050
--- /dev/null
+++ b/conf/application.properties
@@ -0,0 +1,13 @@
+redkale.name=zhub-dev
+redkale.port=6560
+redkale.server[0].protocol=HTTP
+redkale.server[0].host=127.0.0.1
+redkale.server[0].port=80
+# redkale.server[0].root = root
+redkale.server[0].rest.autoload=true
+redkale.server[0].rest.path=
+redkale.server[0].services[0].autoload=true
+# zhub
+redkale.cluster.zhub[hub].addr=47.111.150.118:6066
+redkale.cluster.zhub[hub].auth=zchd@123456
+redkale.cluster.zhub[hub].groupid=venue-zhub
\ No newline at end of file
diff --git a/conf/application.xml b/conf/application.xml
deleted file mode 100644
index 3c2e3ed..0000000
--- a/conf/application.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/kafak.properties b/conf/kafak.properties
deleted file mode 100644
index 37bcd72..0000000
--- a/conf/kafak.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# Producer
-#bootstrap.servers=47.111.150.118:6062
-#bootstrap.servers=121.196.17.55:6062
-bootstrap.servers=39.108.56.246:9092
-#bootstrap.servers=122.112.180.156:6062
-acks=all
-retries=0
-batch.size=16384
-linger.ms=1
-buffer.memory=33554432
-key.serializer=org.apache.kafka.common.serialization.StringSerializer
-value.serializer=org.apache.kafka.common.serialization.StringSerializer
-
-# Consumer
-enable.auto.commit=true
-auto.commit.interval.ms=1000
-group.id=
-key.deserializer=org.apache.kafka.common.serialization.StringDeserializer
-value.deserializer=org.apache.kafka.common.serialization.StringDeserializer
\ No newline at end of file
diff --git a/conf/logging.properties b/conf/logging.properties
new file mode 100644
index 0000000..ab86219
--- /dev/null
+++ b/conf/logging.properties
@@ -0,0 +1,18 @@
+handlers=java.util.logging.ConsoleHandler
+# handlers = java.util.logging.FileHandler
+############################################################
+.level=FINEST
+java.level=INFO
+javax.level=INFO
+com.sun.level=INFO
+sun.level=INFO
+jdk.level=INFO
+java.util.logging.FileHandler.level=FINER
+#10M
+java.util.logging.FileHandler.limit=10M
+java.util.logging.FileHandler.count=20
+java.util.logging.FileHandler.encoding=UTF-8
+java.util.logging.FileHandler.pattern=${APP_HOME}/logs-%tY%tm/log-%tY%tm%td.log
+java.util.logging.FileHandler.unusual=${APP_HOME}/logs-%tY%tm/log-warnerr-%tY%tm%td.log
+java.util.logging.FileHandler.append=true
+java.util.logging.ConsoleHandler.level=FINEST
diff --git a/conf/source.properties b/conf/source.properties
new file mode 100644
index 0000000..741210c
--- /dev/null
+++ b/conf/source.properties
@@ -0,0 +1,5 @@
+############ ClusterSource @Resource(name="hub") ############
+# redkale.cluster.zhub[hub].addr = 47.111.150.118:6066
+# redkale.cluster.zhub[hub].auth = zchd@123456
+# redkale.cluster.zhub[hub].groupid = venue-zhub
+
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..96d099f
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,17 @@
+
+
+ 4.0.0
+
+ net.tccn
+ zhub-client-redkale
+ 1.0-SNAPSHOT
+
+
+ 17
+ 17
+ UTF-8
+
+
+
\ No newline at end of file
diff --git a/src/com/zdemo/ZhubListener.java b/src/com/zdemo/ZhubListener.java
deleted file mode 100644
index 7db44f7..0000000
--- a/src/com/zdemo/ZhubListener.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.zdemo;
-
-import org.redkale.boot.Application;
-import org.redkale.boot.ApplicationListener;
-import org.redkale.service.Service;
-import org.redkale.util.AnyValue;
-import org.redkale.util.RedkaleClassLoader;
-import org.redkale.util.ResourceFactory;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.concurrent.CompletableFuture;
-
-/**
- * 服务监听
- *
- * @author: liangxy.
- */
-public class ZhubListener implements ApplicationListener {
-
- @Override
- public void preStart(Application application) {
-
- CompletableFuture.runAsync(() -> {
- ResourceFactory resourceFactory = application.getResourceFactory();
- RedkaleClassLoader classLoader = application.getClassLoader();
-
- AnyValue appConfig = application.getAppConfig();
- AnyValue zhubs = appConfig.getAnyValue("zhubs");
- AnyValue[] values = zhubs.getAnyValues("zhub");
- for (AnyValue zhub : values) {
- String className = zhub.getValue("value", "com.zdemo.zhub.ZHubClient");
- try {
- Class> clazz = classLoader.loadClass(className);
- Service obj = (Service) clazz.getDeclaredConstructor().newInstance();
- application.getResourceFactory().inject(obj);
- obj.init(zhub);
- resourceFactory.register(zhub.get("name"), clazz, obj);
- } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException | ClassNotFoundException e) {
- e.printStackTrace();
- }
- }
- });
- }
-
- @Override
- public void preShutdown(Application application) {
-
- }
-}
diff --git a/src/com/zdemo/cache_/RedisCacheSource.java b/src/com/zdemo/cache_/RedisCacheSource.java
deleted file mode 100644
index 4bf837e..0000000
--- a/src/com/zdemo/cache_/RedisCacheSource.java
+++ /dev/null
@@ -1,2173 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.zdemo.cache_;
-
-import org.redkale.convert.Convert;
-import org.redkale.convert.json.JsonConvert;
-import org.redkale.convert.json.JsonFactory;
-import org.redkale.net.AsyncConnection;
-import org.redkale.net.Transport;
-import org.redkale.net.TransportFactory;
-import org.redkale.service.AbstractService;
-import org.redkale.service.Local;
-import org.redkale.service.Service;
-import org.redkale.source.CacheSource;
-import org.redkale.source.Flipper;
-import org.redkale.util.*;
-import org.redkale.util.AnyValue.DefaultAnyValue;
-
-import javax.annotation.Resource;
-import java.io.IOException;
-import java.io.Serializable;
-import java.lang.reflect.Type;
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-import java.nio.ByteBuffer;
-import java.nio.channels.CompletionHandler;
-import java.nio.charset.StandardCharsets;
-import java.util.*;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Semaphore;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import static org.redkale.boot.Application.RESNAME_APP_GROUP;
-
-/**
- * 详情见: https://redkale.org
- *
- * @param Value
- * @author zhangjx
- */
-@Local
-@AutoLoad(false)
-@ResourceType(CacheSource.class)
-public class RedisCacheSource extends AbstractService implements CacheSource, Service, AutoCloseable, Resourcable {
-
- protected static final byte DOLLAR_BYTE = '$';
-
- protected static final byte ASTERISK_BYTE = '*';
-
- protected static final byte PLUS_BYTE = '+';
-
- protected static final byte MINUS_BYTE = '-';
-
- protected static final byte COLON_BYTE = ':';
-
- private final Logger logger = Logger.getLogger(this.getClass().getSimpleName());
-
- @Resource(name = RESNAME_APP_GROUP)
- protected AsyncGroup asyncGroup;
-
- @Resource
- public JsonConvert defaultConvert;
-
- @Resource(name = "$_convert")
- public JsonConvert convert;
-
- protected Type objValueType = String.class;
-
- protected Map passwords;
-
- protected List nodeAddrs;
-
- protected int db;
-
- protected Transport transport;
-
- @Override
- public void init(AnyValue conf) {
- if (this.convert == null) this.convert = this.defaultConvert;
- if (conf == null) conf = new DefaultAnyValue();
- final int readTimeoutSeconds = conf.getIntValue("readTimeoutSeconds", TransportFactory.DEFAULT_READTIMEOUTSECONDS);
- final int writeTimeoutSeconds = conf.getIntValue("writeTimeoutSeconds", TransportFactory.DEFAULT_WRITETIMEOUTSECONDS);
- final List addresses = new ArrayList<>();
- Map passwords0 = new HashMap<>();
- for (AnyValue node : conf.getAnyValues("node")) {
- String addrstr = node.getValue("addr");
- InetSocketAddress addr = null;
- if (addrstr.startsWith("redis://")) {
- addrstr = addrstr.substring("redis://".length());
- int pos = addrstr.indexOf(':');
- addr = new InetSocketAddress(addrstr.substring(0, pos), Integer.parseInt(addrstr.substring(pos + 1)));
- addresses.add(addr);
- } else {
- addr = new InetSocketAddress(addrstr, node.getIntValue("port"));
- addresses.add(addr);
- }
- String password = node.getValue("password", "").trim();
- if (!password.isEmpty()) passwords0.put(addr, password.getBytes(StandardCharsets.UTF_8));
- String db0 = node.getValue("db", "").trim();
- if (!db0.isEmpty()) this.db = Integer.valueOf(db0);
- }
- if (!passwords0.isEmpty()) this.passwords = passwords0;
- this.nodeAddrs = addresses;
- TransportFactory transportFactory = TransportFactory.create(asyncGroup, readTimeoutSeconds, writeTimeoutSeconds);
- this.transport = transportFactory.createTransportTCP("Redis-Transport", null, addresses);
- this.transport.setSemaphore(new Semaphore(conf.getIntValue("maxconns", 1000)));
- if (logger.isLoggable(Level.FINE))
- logger.log(Level.FINE, RedisCacheSource.class.getSimpleName() + ": addrs=" + addresses + ", db=" + db);
-
- }
-
- @Override //ServiceLoader时判断配置是否符合当前实现类
- public boolean match(AnyValue config) {
- if (config == null) return false;
- AnyValue[] nodes = config.getAnyValues("node");
- if (nodes == null || nodes.length == 0) return false;
- for (AnyValue node : nodes) {
- if (node.getValue("addr") != null && node.getValue("port") != null) return true;
- if (node.getValue("addr") != null && node.getValue("addr").startsWith("redis://")) return true;
- }
- return false;
- }
-
- public void updateRemoteAddresses(final Collection addresses) {
- this.transport.updateRemoteAddresses(addresses);
- }
-
- @Override
- @Deprecated
- public final void initValueType(Type valueType) {
- this.objValueType = valueType == null ? String.class : valueType;
- }
-
- @Override
- @Deprecated
- public final void initTransient(boolean flag) {
- }
-
- @Override
- public final String getType() {
- return "redis";
- }
-
- public static void main(String[] args) throws Exception {
- DefaultAnyValue conf = new DefaultAnyValue().addValue("maxconns", "1");
- conf.addValue("node", new DefaultAnyValue().addValue("addr", "127.0.0.1").addValue("port", "6363"));
-
- final AsyncIOGroup asyncGroup = new AsyncIOGroup(8192, 16);
- asyncGroup.start();
- ResourceFactory.root().register(RESNAME_APP_GROUP, asyncGroup);
-
- RedisCacheSource source = new RedisCacheSource();
- ResourceFactory.root().inject(source);
- source.init(null);
- source.defaultConvert = JsonFactory.root().getConvert();
- source.init(conf);
- InetSocketAddress addr = new InetSocketAddress("127.0.0.1", 7788);
- try {
- System.out.println("------------------------------------");
- source.removeAsync("stritem1");
- source.removeAsync("stritem2");
- source.setStringAsync("stritem1", "value1");
- source.setStringAsync("stritem2", "value2");
- System.out.println("stritem开头的key有两个: " + source.queryKeysStartsWith("stritem"));
- System.out.println("[有值] MGET : " + source.getStringMap("stritem1", "stritem2"));
- System.out.println("[有值] MGET : " + Arrays.toString(source.getStringArray("stritem1", "stritem2")));
-
- source.remove("intitem1");
- source.remove("intitem2");
- source.setLong("intitem1", 333);
- source.setLong("intitem2", 444);
- System.out.println("[有值] MGET : " + source.getStringMap("intitem1", "intitem22", "intitem2"));
- System.out.println("[有值] MGET : " + Arrays.toString(source.getStringArray("intitem1", "intitem22", "intitem2")));
- source.remove("objitem1");
- source.remove("objitem2");
- source.set("objitem1", Flipper.class, new Flipper(10));
- source.set("objitem2", Flipper.class, new Flipper(20));
- System.out.println("[有值] MGET : " + source.getMap(Flipper.class, "objitem1", "objitem2"));
-
- source.remove("key1");
- source.remove("key2");
- source.remove("300");
- source.set(1000, "key1", String.class, "value1");
- source.set("key1", String.class, "value1");
- source.setString("keystr1", "strvalue1");
- source.setLong("keylong1", 333L);
- source.set("300", String.class, "4000");
- source.getAndRefresh("key1", 3500, String.class);
- System.out.println("[有值] 300 GET : " + source.get("300", String.class));
- System.out.println("[有值] key1 GET : " + source.get("key1", String.class));
- System.out.println("[无值] key2 GET : " + source.get("key2", String.class));
- System.out.println("[有值] keystr1 GET : " + source.getString("keystr1"));
- System.out.println("[有值] keylong1 GET : " + source.getLong("keylong1", 0L));
- System.out.println("[有值] key1 EXISTS : " + source.exists("key1"));
- System.out.println("[无值] key2 EXISTS : " + source.exists("key2"));
-
- source.remove("keys3");
- source.appendListItem("keys3", String.class, "vals1");
- source.appendListItem("keys3", String.class, "vals2");
- System.out.println("-------- keys3 追加了两个值 --------");
- System.out.println("[两值] keys3 VALUES : " + source.getCollection("keys3", String.class));
- System.out.println("[有值] keys3 EXISTS : " + source.exists("keys3"));
- source.removeListItem("keys3", String.class, "vals1");
- System.out.println("[一值] keys3 VALUES : " + source.getCollection("keys3", String.class));
- source.getCollectionAndRefresh("keys3", 3000, String.class);
-
- source.remove("stringmap");
- source.appendSetItem("stringmap", JsonConvert.TYPE_MAP_STRING_STRING, Utility.ofMap("a", "aa", "b", "bb"));
- source.appendSetItem("stringmap", JsonConvert.TYPE_MAP_STRING_STRING, Utility.ofMap("c", "cc", "d", "dd"));
- System.out.println("[两值] stringmap VALUES : " + source.getCollectionAsync("stringmap", JsonConvert.TYPE_MAP_STRING_STRING).join());
-
- source.remove("sets3");
- source.remove("sets4");
- source.appendSetItem("sets3", String.class, "setvals1");
- source.appendSetItem("sets3", String.class, "setvals2");
- source.appendSetItem("sets3", String.class, "setvals1");
- source.appendSetItem("sets4", String.class, "setvals2");
- source.appendSetItem("sets4", String.class, "setvals1");
- System.out.println("[两值] sets3 VALUES : " + source.getCollection("sets3", String.class));
- System.out.println("[有值] sets3 EXISTS : " + source.exists("sets3"));
- System.out.println("[有值] sets3-setvals2 EXISTSITEM : " + source.existsSetItem("sets3", String.class, "setvals2"));
- System.out.println("[有值] sets3-setvals3 EXISTSITEM : " + source.existsSetItem("sets3", String.class, "setvals3"));
- source.removeSetItem("sets3", String.class, "setvals1");
- System.out.println("[一值] sets3 VALUES : " + source.getCollection("sets3", String.class));
- System.out.println("sets3 大小 : " + source.getCollectionSize("sets3"));
- System.out.println("all keys: " + source.queryKeys());
- System.out.println("key startkeys: " + source.queryKeysStartsWith("key"));
- System.out.println("newnum 值 : " + source.incr("newnum"));
- System.out.println("newnum 值 : " + source.decr("newnum"));
- System.out.println("sets3&sets4: " + source.getStringCollectionMap(true, "sets3", "sets4"));
- System.out.println("------------------------------------");
- source.set("myaddr", InetSocketAddress.class, addr);
- System.out.println("myaddrstr: " + source.getString("myaddr"));
- System.out.println("myaddr: " + source.get("myaddr", InetSocketAddress.class));
- source.remove("myaddrs");
- source.remove("myaddrs2");
- source.appendSetItem("myaddrs", InetSocketAddress.class, new InetSocketAddress("127.0.0.1", 7788));
- source.appendSetItem("myaddrs", InetSocketAddress.class, new InetSocketAddress("127.0.0.1", 7799));
- System.out.println("myaddrs: " + source.getCollection("myaddrs", InetSocketAddress.class));
- source.removeSetItem("myaddrs", InetSocketAddress.class, new InetSocketAddress("127.0.0.1", 7788));
- System.out.println("myaddrs: " + source.getCollection("myaddrs", InetSocketAddress.class));
- source.appendSetItem("myaddrs2", InetSocketAddress.class, new InetSocketAddress("127.0.0.1", 7788));
- source.appendSetItem("myaddrs2", InetSocketAddress.class, new InetSocketAddress("127.0.0.1", 7799));
- System.out.println("myaddrs&myaddrs2: " + source.getCollectionMap(true, InetSocketAddress.class, "myaddrs", "myaddrs2"));
- System.out.println("------------------------------------");
- source.remove("myaddrs");
- Type mapType = new TypeToken